- 浏览: 623417 次
- 性别:
- 来自: 杭州
文章分类
最新评论
-
luo_ganlin:
别的不多说,点个赞!
关于Android隐式启动Activity -
IWSo:
谢楼主!研究了好久,原来是这样!
android中如何让LinearLayout实现点击时背景图片切换 -
fantao005x:
粘帖的不错
android中如何让listview的内容全部显示出来 -
learner576539763:
Android_gqs 写道请问博主,Viewstub 可实现 ...
android中ViewStub使用 -
goontosoon:
抄的什么啊,狗屁不通
对ContentProvider中getType(Uri uri)
sendBroadcast和sendStickyBroadcast的区别
- 博客分类:
- android
我们平时最经常使用的是sendBroadcast,就是把一个Intent广播出去。今天我在看wifi的时候,还发现了sendStickyBroadcast。官方文档是这样写的: public abstract void sendStickyBroadcast (Intent intent) Since: API Level 1 Perform a sendBroadcast(Intent) that is "sticky," meaning the Intent you are sending stays around after the broadcast is complete, so that others can quickly retrieve that data through the return value of registerReceiver(BroadcastReceiver, IntentFilter). In all other ways, this behaves the same as sendBroadcast(Intent). You must hold the BROADCAST_STICKY permission in order to use this API. If you do not hold that permission, SecurityException will be thrown. Parameters intent The Intent to broadcast; all receivers matching this Intent will receive the broadcast, and the Intent will be held to be re-broadcast to future receivers. 光从字面的意思是很难理解的。只有你写例子才会明白的。 Java代码
Java代码
|
发表评论
-
EditText软键盘弹出问题解决
2013-02-26 23:10 1399当带有EditView的activity第一次进入时,第一 ... -
android中获取系统相关属性adb
2012-11-15 14:41 21421.查看系统相关属性可以通过: adb shell ... -
Android使用Intent传递复杂参数及复杂参数列表
2012-11-05 17:29 1573刚开始一直纠结于Intent只能put像int, ... -
解决P6200/P6800扩展卡第三方软件不可写的BUG
2012-11-05 17:01 982从XDA看来的步骤:1. Using a root-e ... -
android 中跟actionbar相关的属性
2012-10-25 17:07 2432android:uiOptions 这个属性用于设置A ... -
source insight使用快捷键
2012-10-25 10:59 1503F5指定行号,实现行跳转,在遇到编译错误的时候,能特 ... -
android中推出应用比较有效率的方法
2012-10-11 16:57 1119添加一个全局变量作为程序退出的标记(boolean类型) ... -
declare-styleable的使用
2012-10-09 13:59 1112declare-styleable的使用 decl ... -
android程序安全的建议
2012-09-29 14:58 5210如果保证自己的 ... -
Java自带的线程池ThreadPoolExecutor详细介绍说明和实例应用
2012-09-29 14:45 1028从 Java 5 开始,Java 提供了自己的线程池。线 ... -
android应用检测更新代码
2012-09-24 17:40 1748JAVA代码: UpdateManager.java ... -
adb命令详解
2012-09-19 15:04 2776Android adb的常用命令略解 Androi ... -
android中屏蔽其它系统按钮的dialog
2012-09-18 10:13 1605public class MyProgress ... -
如何给Scrollview里内容截屏并生成bitmap,注意:Scrollview里面内容较多有滚动了
2012-09-18 10:07 1598使用for循环递归累加其内部的子控件的高度: p ... -
wakelock的使用
2012-09-17 11:44 10028PowerManager.WakerLock是我分析St ... -
启动另外一个apk
2012-09-14 13:16 857这篇博文主要是获取其他apk程序的启动的主intent, ... -
android中全屏的方法
2012-09-14 13:04 9221.直接代码编写 @Override ... -
android:installLocation简析
2012-09-12 15:25 1068在Froyo(android 2.2,API Le ... -
外部apk启动启动另外一个apk
2012-09-06 17:54 1007public class TestingBroadc ... -
listview如何实现圆角
2012-09-05 17:32 1898首先呢,我们还是看几个示图:(这是360推出的一款天气预 ...
相关推荐
最经典的关于sendBroadcast与sendStickyBroadcast的区别分析与讲解
android broadcast实例,包括sendBroadcast、 sendOrderedBroadcast、 sendStickyBroadcast三种实现方法
Android应用程序发送广播(sendBroadcast)的过程分析
将intent对象传给 Context.sendBroadcast(), Context.sendOrderedBroadcast(),或者Context.sendStickyBroadcast()等广播方法,则它们被传给 broadcast receiver. 在上述三种情况下, android系统会自己找到合适的...
• 传递给任意广播方法(例如Context.sendBroadcast(),Context.sendOrderedBroadcast(), 或者Context.sendStickyBroadcast())的意图对象被传递给所有感兴趣的广播接收者。许多种广播产生于系统代码。 在每个例子里...
详情见:Android 静默安装和静默卸载(系统层) http://blog.csdn.net/zhouyuanjing/article/details/78507606 安装: Intent intent = new Intent("android.intent.action.SILENT_PACKAGE_INSTALL"); intent....
Arduino-meshquitto.zip,一个简单的Arduino项目,旨在在ESP8266的网状网络和远程MQTT代理之间提供网关。,Arduino是一家开源软硬件公司和制造商社区。Arduino始于21世纪初,深受电子制造商的欢迎,Arduino通过开源...
android中广播接收者,有序广播和无序广播 sendOrderBroadcast sendBroadcast
实现用户自定义程序向其他应用程序发送广播,通过sendBroadcast方法实现
【实验要求】 1、 练习使用静态方法和动态方法注册广播接收器 2、 练习发送广播消息的方法 3、 完成实验报告 二、实验内容 1、 新建 Android 应用程序项目 BroadcastTest; 2、 业务逻辑代码与界面布局文件如下: 1)...
sendBroadcast(intent); 或者 Intent intent = new Intent(); intent.setAction("ACTION_USB_PERMISSION_ISSUER"); intent.putExtra("packageName", "你的app-package"); intent.putExtra("vendorId", 1569);/...
最新版本6.1.6 添加支持Java 1.6 添加支持Java 1.7 添加完整的支持activityForResult,sendBroadcast和RegisterReceiver。 添加额外类型。安装安装: cordova plugin add com.lampa.startapp 安装: cordova plugin...
用于异步接收广播Intent,广播Intent的发送是通过调用Context.sendBroadcast()、广播接收者(BroadcastReceiver)用于...sendBroadcast()、Context.sendOrderedBroadcast()或者Context.sendStickyBroadcast()来实现的...
广播意图就是通过Context.sendBroadcast(Intent intent)或Context.sendOrderedBroadcast(Intent intent)发送的意图,通过这个语句,能够广播给所有满足条件的组件,比如intent设置了action=”com.xiazdong
在sendBroadcast,startActivity时,我们会用到Intent。 Intent可以携带一些数据,比如基本类型数据int、Boolean,或是String,或是序列化对象,Parcelable与Serializable。 Intent传递数据时,如果数据太大,可能...
本节讲运行在后台服务里的工作请求,如何向...下一步,调用 LocalBroadcastManager.sendBroadcast()发送Intent,应用中所有注册了接收该广播的接收器都能收到。LocalBroadcastManager.getInstance()获取LocalBroadcastM
通过Retrofit回调(将从端点提供数据),将包含联系人头像的sendbroadcast发送给Activity,后者将处理该意图。 游标加载程序将管理列表中名字和姓氏的显示,并且头像将填充图像视图(在这种情况下,我们不将图像...
Android 创建快捷方式图标,这个挺简单,有兴趣的Android初学者可参考研究. ... sendBroadcast(addIntent);//发送广播 } else if(v == myButton2){//按下了退出按钮 System.exit(0);//退出系统 }