LocalBroadcastManager使用简析
来源:互联网 发布:淘宝客服骂人怎么处罚 编辑:程序博客网 时间:2024/05/28 11:28
LocalBroadcastManager属于v4包里面的类。
android.support.v4.content.LocalBroadcastManager
developer里面OverView是这么写的:
Helper to register for and send broadcasts of intents to local objects within your peocess.this is has a number of advantages over sending global broadcasts with sendBroadcast(Intent):
.You know that the data you are braodcasting won’t leave your app,so don’t need to worry about leaking private data.
.It is not possible for other applications to send these broadcasts to your app,so you don’t need to worry about having security holes they can exploit.
.It is more effcient than sending a global broadcast through the system.
通过粗体部分能看出来这是一个在你app内部通信的方法,在app内部通信上和全局的boradcast相比有优势。体现为:
1.因为是内部通信不会离开该app,所以不用担心数据泄露出去。
2.比全局boradcast更有效率.
3.内部方法不用担心安全问题.
使用也很简单:
LocalBroadCastManager.getInstance(context).registerReceiver(receiver,intentfilter);LocalBroadCastManager.getInstance(context).sendBroadcast(Intent);LocalBroadCastManager.getInstance(context).unregisterReiver(receiver);
- LocalBroadcastManager使用简析
- 使用LocalBroadcastManager
- 使用LocalBroadcastManager
- 使用LocalBroadcastManager
- 使用LocalBroadcastManager
- 使用LocalBroadcastManager
- 使用LocalBroadcastManager
- 使用LocalBroadcastManager
- 使用LocalBroadcastManager
- LocalBroadcastManager 使用详结
- LocalBroadcastManager的使用
- LocalBroadcastManager 使用小结
- LocalBroadcastManager的使用总结
- LocalBroadcastManager 的使用
- android LocalBroadcastManager的使用
- LocalBroadcastManager的使用
- Android LocalBroadCastManager 使用总结
- LocalBroadcastManager
- cadence学习1 2015.6.23
- Failed to pull selection: Permission denied
- vs2008,2010,2012安装包下载
- Android Tombstone/Crash的log分析和定位
- 分布式和集群区别
- LocalBroadcastManager使用简析
- kdtable回车键光标移动
- DUMPBIN命令使用详解
- 21. 多人协作
- LeetCode---(20)Valid Parentheses
- Behavioral模式之Chain of Responsibility模式
- 前缀、中缀、后缀表达式
- linux可用内存的计算
- bash下的特殊符号与通配符