sendBroadcast翻译

本文详细介绍了Android中ContextWrapper类的sendBroadcast方法,该方法用于异步地将指定Intent广播给所有感兴趣的BroadcastReceiver。文章解释了如何正确使用此方法以及何时应考虑使用sendOrderedBroadcast来允许接收者传递结果或中止广播。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

发送广播

void android.content.ContextWrapper.sendBroadcast(Intent intent)

 

public void sendBroadcast (Intent intent)

Since: API Level 1

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. No results are propagated from receivers and receivers can not abort the broadcast. If you want to allow receivers to propagate results or abort the broadcast, you must send an ordered broadcast using sendOrderedBroadcast(Intent, String).

广播给定的intent给所有感兴趣的BroadcastReceivers,这个调用是异步的;它会立即返回,当接受者运行时,你会继续进行执行。接受者不会返回结果,并且接受者不能忽略这个消息。如果你想接受者返回结果或者取消这个broadcast,你必须使用sendOrderedBroadcast(Intent, String)发送一个排序的broadcast。

 

See BroadcastReceiver for more information on Intent broadcasts.

 

Parameters

intent  The Intent to broadcast; all receivers matching this Intent will receive the broadcast.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值