请问什么时候应该使用意图过滤器和广播接收器?
<activity>
<intent-filter></intent-filter>
</activity>
并且
<receiver>
<intent-filter></intent-filter>
</receiver>
请问什么时候应该使用意图过滤器和广播接收器?
<activity>
<intent-filter></intent-filter>
</activity>
并且
<receiver>
<intent-filter></intent-filter>
</receiver>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
我认为你对隐式意图和广播接收器感到困惑。Activity中的Intent Filter用于接收隐式意图,而Receiver中的Intent Filter用于接收广播。操作系统向所有接收器发送广播消息,而向特定一个活动发送隐式意图。请参见这里。