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 static LocalBroadcastManager getInstance (Context context)

 
 

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的更多相关文章

  1. Android英文文档翻译系列(1)——AlarmManager

      原文:个人翻译,水平有限,欢迎看官指正.                                                              public class Ala ...

  2. Android英文文档翻译系列(5)——VPNService

      API14位于android.net.VpnService 类概述|Class OverviewVpnService is a base class for applications to ext ...

  3. Android英文文档翻译系列(4)——PopupWindow

    public class PopupWindow extends Object //直接继承至Object java.lang.Object ↳ android.widget.PopupWindow  ...

  4. Android英文文档翻译系列(3)——AsyncTask

      AsyncTask——异步任务   个人认为这是翻译比较好的一次.. Class Overview//类概述 AsyncTask enables proper and easy use of th ...

  5. Android英文文档翻译系列(2)——HandlerThread

      public class   HandlerThread extends Thread   Class  Overview Handy class for starting a new threa ...

  6. Android进阶——多线程系列之Thread、Runnable、Callable、Future、FutureTask

    多线程一直是初学者最抵触的东西,如果你想进阶的话,那必须闯过这道难关,特别是多线程中Thread.Runnable.Callable.Future.FutureTask这几个类往往是初学者容易搞混的. ...

  7. Android提升篇系列:Activity recreate(Activity 重新创建/自我恢复)机制(一)

    注:本文中的recreate是指当内存不足时,Activity被回收,但再次来到此Activity时,系统重新恢复的过程.例如:当Activity A到Activity B时,如果内存不足,A被回收, ...

  8. Android控件系列之RadioButton&RadioGroup(转)

    学习目的: 1.掌握在Android中如何建立RadioGroup和RadioButton 2.掌握RadioGroup的常用属性 3.理解RadioButton和CheckBox的区别 4.掌握Ra ...

  9. Android网络编程系列 一 TCP/IP协议族

    在学习和使用Android网路编程时,我们接触的仅仅是上层协议和接口如Apache的httpclient或者Android自带的httpURlconnection等等.对于这些接口的底层实现我们也有必 ...

随机推荐

  1. js json日期格式转换日期方法

      接收json数据,日期格式为:"\/Date(1414078309687)\/" var value = "/Date(1414078309687)/"; ...

  2. winform 应用log4net做日志记录到mysql

    1.nuget装log4net 2.nuget控件台装 mysql.data Install-Package mysql.data -version 6.8.3 (太高的版本用不了,切记) 3.修改a ...

  3. u3d 加载PNG做 UI图片

    using UnityEngine; using System.Collections; using System.IO; using UnityEngine.UI; public class UIT ...

  4. rsync工具介绍 rsync常用选项 rsync通过ssh同步

    linux文件同步工具-rsync [root@centos7 tmp]# yum install -y rsync rsync可以增量的同步,只同步变更的文件 把/etc/passwd 同步到/tm ...

  5. mysql 解压版方法

    来自http://zhidao.baidu.com/link?url=RtXb2QKYTQ8Yd5TdTS7XHHiupzDaM19vlVBIrHTVmT7ZHi8kG3O9L6D6nnsfTGE-- ...

  6. Windows 2008禁止IE增强安全配置修改安全设置方法

    windows 2008更改IE安全设置 在默认状态下,使用Windows Server 2008系统自带的IE浏览器访问网页内容时,我们时常发现页面内容显示不全.后来,我们进入IE浏览器的Inter ...

  7. 【转帖】Linux发行版:CentOS、Ubuntu、RedHat、Android、Tizen、MeeGo

     Linux发行版:CentOS.Ubuntu.RedHat.Android.Tizen.MeeGo作者:阳光岛主 原文在这儿 Linux,最早由Linus Benedict Torvalds在199 ...

  8. jquery方法.serializeArray()获取name和value并转为json数组

    jquery的.serializeArray()方法可以获取形如以下 [ {name: 'firstname', value: 'Hello'}, {name: 'lastname', value: ...

  9. springboot+mybatis集成多数据源MySQL/Oracle/SqlServer

    日常开发中可能时常会遇到一些这样的需求,业务数据库和第三方数据库,两个或多个数据库属于不同数据库厂商,这时候就需要通过配置来实现对数据库实现多源处理.大致说一下我的业务场景,框架本身是配置的sprin ...

  10. RMAN:简单的duplicate创建新数据库 for 12c+

    构建参数文件 *.db_name='test2' ##### 需要注意的地方,和rman的duplicate目标库一致 *.compatible='18.0.0' ##### 关键的地方,每个版本的模 ...