可以以编程方式设置 BroadcastReceiver 优先级吗?
是否可以通过编程方式设置 BroadcastReceiver 的优先级属性,或者只能在 XML 中完成? 相关文档包括:
http://developer.android.com/reference/android/content /BroadcastReceiver.html
http://developer.android.com/reference /android/R.styleable.html
看起来并非如此,但我不完全理解 android.R.styleable 与给定应用程序及其活动的关系...
Is it possible to set the priority attribute of a BroadcastReceiver programmatically or can it only be done in XML?
Relevant documents include:
http://developer.android.com/reference/android/content/BroadcastReceiver.html
http://developer.android.com/reference/android/R.styleable.html
It doesn't seem so, but I don't fully understand the relationship of android.R.styleable to a given application and its activities...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您无需为
BroadcastReceiver
(或Activity
)对象设置优先级,而是为导致这些项目被执行的IntentFilter
对象设置优先级。开始了。考虑到这一点,
IntentFilter.setPriority()< /code>
是您想要使用的。
You don't set priority on
BroadcastReceiver
(orActivity
) objects, but instead on theIntentFilter
object(s) that cause these items to be started.With that in mind,
IntentFilter.setPriority()
is what you want to use.