Android英文文档翻译系列(6)——LocalBroadcastManager
public class
LocalBroadcastManager
extends Object
| java.lang.Object | |
| ↳ | android.support.v4.content.LocalBroadcastManager |
Class Overview
Helper to register for and send broadcasts of Intents to local objects within your process. This is has a number of advantages over sending global broadcasts withsendBroadcast(Intent):
- You know that the data you are broadcasting 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 efficient than sending a global broadcast through the system.
Summary
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| static LocalBroadcastManager | getInstance(Context context) | ||||||||||
| void | registerReceiver(BroadcastReceiver receiver, IntentFilter filter)
Register a receive for any local broadcasts that match the given IntentFilter.
|
||||||||||
| boolean | sendBroadcast(Intent intent)
Broadcast the given intent to all interested BroadcastReceivers.
|
||||||||||
| void | sendBroadcastSync(Intent intent)
Like
sendBroadcast(Intent), but if there are any receivers for the Intent this function will block and immediately dispatch them before returning. |
||||||||||
| void | unregisterReceiver(BroadcastReceiver receiver)
Unregister a previously registered BroadcastReceiver.
|
||||||||||
| [Expand]
Inherited Methods
|
|||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class java.lang.Object
|
|||||||||||
Public Methods
public void registerReceiver (BroadcastReceiver receiver, IntentFilter filter)
Register a receive for any local broadcasts that match the given IntentFilter.
Parameters
| receiver | The BroadcastReceiver to handle the broadcast. |
|---|---|
| filter | Selects the Intent broadcasts to be received. |
public boolean sendBroadcast (Intent intent)
Broadcast the given intent to all interested BroadcastReceivers. This call is asynchronous; it returns immediately, and you will continue executing while the receivers are run.
Parameters
| intent | The Intent to broadcast; all receivers matching this Intent will receive the broadcast. |
|---|
public void sendBroadcastSync (Intent intent)
Like sendBroadcast(Intent), but if there are any receivers for the Intent this function will block and immediately dispatch them before returning.
public void unregisterReceiver (BroadcastReceiver receiver)
Unregister a previously registered BroadcastReceiver. All filters that have been registered for this BroadcastReceiver will be removed.
Parameters
| receiver | The BroadcastReceiver to unregister. |
|---|
Android英文文档翻译系列(6)——LocalBroadcastManager的更多相关文章
- Android英文文档翻译系列(1)——AlarmManager
原文:个人翻译,水平有限,欢迎看官指正. public class Ala ...
- Android英文文档翻译系列(5)——VPNService
API14位于android.net.VpnService 类概述|Class OverviewVpnService is a base class for applications to ext ...
- Android英文文档翻译系列(4)——PopupWindow
public class PopupWindow extends Object //直接继承至Object java.lang.Object ↳ android.widget.PopupWindow ...
- Android英文文档翻译系列(3)——AsyncTask
AsyncTask——异步任务 个人认为这是翻译比较好的一次.. Class Overview//类概述 AsyncTask enables proper and easy use of th ...
- Android英文文档翻译系列(2)——HandlerThread
public class HandlerThread extends Thread Class Overview Handy class for starting a new threa ...
- Android进阶——多线程系列之Thread、Runnable、Callable、Future、FutureTask
多线程一直是初学者最抵触的东西,如果你想进阶的话,那必须闯过这道难关,特别是多线程中Thread.Runnable.Callable.Future.FutureTask这几个类往往是初学者容易搞混的. ...
- Android提升篇系列:Activity recreate(Activity 重新创建/自我恢复)机制(一)
注:本文中的recreate是指当内存不足时,Activity被回收,但再次来到此Activity时,系统重新恢复的过程.例如:当Activity A到Activity B时,如果内存不足,A被回收, ...
- Android控件系列之RadioButton&RadioGroup(转)
学习目的: 1.掌握在Android中如何建立RadioGroup和RadioButton 2.掌握RadioGroup的常用属性 3.理解RadioButton和CheckBox的区别 4.掌握Ra ...
- Android网络编程系列 一 TCP/IP协议族
在学习和使用Android网路编程时,我们接触的仅仅是上层协议和接口如Apache的httpclient或者Android自带的httpURlconnection等等.对于这些接口的底层实现我们也有必 ...
随机推荐
- Spring JDBC插入数据
以下示例将展示如何使用Spring jdbc进行插入查询.将向student表中插入几条记录. 语法: String insertQuery = "insert into student ( ...
- Unity 基础-------------------------关于Anchor锚点的理解
Unity进阶技巧 - RectTransform详解 Zui 关注 2016.02.17 01:27 字数 1704 阅读 22157评论 13喜欢 57赞赏 2 RectTransform属性一览 ...
- [poj 1947] Rebuilding Roads 树形DP
Rebuilding Roads Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 10653 Accepted: 4884 Des ...
- bind带autocomplete时,最好是从新的tr复制
(function($) { //自动关联ItemNo $.fn.extend({ productitemlist: function(options) { return this.each(func ...
- RGB转LAB色彩空间
1.原理 RGB无法直接转换成LAB,需要先转换成XYZ再转换成LAB,即:RGB——XYZ——LAB 因此转换公式分两部分: (1)RGB转XYZ 假设r,g,b为像素三个通道,取值范围均为[0,2 ...
- UNIX环境编程学习笔记(3)——文件I/O之内核 I/O 数据结构
lienhua342014-08-27 内核使用三种数据结构表示打开的文件,分别是文件描述符表.文件表和 V 节点表. (1) 每个进程在进程表中都有一个记录项,记录项中包含有一张打开文件描述符表,每 ...
- [转]java的(PO,VO,TO,BO,DAO,POJO)类名包名解释
java的(PO,VO,TO,BO,DAO,POJO)类名包名解释 2015-04-28 20:11 by Loull, 18 阅读, 0 评论, 收藏, 编辑 VO:值对象.视图对象 PO:持久对象 ...
- level1 -- unit 3 - 频率副词
频率副词 never sometimes usually always never 从不 sometimes 有时 usually 通常 always 总是 频率排名(从最不到最经常): never ...
- WPF - How to force a Command to re-evaluate 'CanExecute' via its CommandBindings
Not the prettiest in the book, but you can use the CommandManager to invalidate all commandbinding: ...
- 视觉单词模型、词袋模型BoW
多用于图像检索.分类 3.2.1.4 视觉单词模型 视觉词袋(BoVW,Bag of Visual Words)模型,是“词袋”(BoW,Bag of Words)模型从自然语言处理与分析领域向图像处 ...
From class