是否可以通过编程方式设置BroadcastReceiver的优先级属性,还是只能用XML来完成?
相关文件包括:
http://developer.android.com/reference/android/content/BroadcastReceiver.html
http://developer.android.com/reference/android/R.styleable.html
似乎并非如此,但我不完全了解android.R.styleable与给定应用程序及其 Activity 的关系...
最佳答案
您没有在BroadcastReceiver
(或Activity
)对象上设置优先级,而是在导致这些项目开始的IntentFilter
对象上设置了优先级。
考虑到这一点, IntentFilter.setPriority()
是您要使用的。