添加意图活动动态 [英] Adding intent to activity dynamically
问题描述
我已经得到了我已经在AndroidManifest.xml静态定义的一个意图过滤器的活动。我想注册其他意图动态地在活动的调用onStart()方法,目的相同的过滤器。这可能吗?我试图避免实施单独的意图接收器类。
这可能吗?
块引用>没有,对不起。
我试图避免实施单独的意图接收器类。
块引用>您没有选择 - 一个
意图
与sendBroadcast()
不会由接收使用活性的任何其他方式。不要混淆startActivity()
意图
与sendBroadcast()
意图
。I've got an activity for which I've defined an intent filter statically in AndroidManifest.xml. I'd like to register additional intents dynamically to that same intent filter in the activity's onStart() method. Is this possible? I'm trying to avoid having to implement a separate intent receiver class.
解决方案Is this possible?
No, sorry.
I'm trying to avoid having to implement a separate intent receiver class.
You have no choice -- an
Intent
used withsendBroadcast()
is not going to be received by an activity any other way. Do not confusestartActivity()
Intents
withsendBroadcast()
Intents
.这篇关于添加意图活动动态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!