Android-意图解析规则-操作和类别
我正在尝试创建与以下测试意图过滤器匹配的意图:Android-意图解析规则-操作和类别,android,android-intent,Android,Android Intent,我正在尝试创建与以下测试意图过滤器匹配的意图: <intent-filter> <action android:name="com.android.testApp.app.testAction"/> <action android:name="com.android.testApp.app.testAction_2"/> <category android:name="android.intent.category.DEFAULT" /
<intent-filter>
<action android:name="com.android.testApp.app.testAction"/>
<action android:name="com.android.testApp.app.testAction_2"/>
<category android:name="android.intent.category.DEFAULT" />
<category android:name="com.android.testApp.app.testCategory" />
</intent-filter>
但是,此意图无法通过意图过滤器。有人能指出原因吗?因为你有两个动作,所以你需要这样的动作:@ligi我想测试,但不要在意图中指定任何动作。根据规则,它应该通过,对吗?但是你的意图过滤器已经通过了actions@ligi来自文档:如果意图没有指定操作,它将通过测试(只要过滤器至少包含一个操作)。@ligi
Intent intent = new Intent();
intent.addCategory("com.android.testApp.app.testCategory");
startActivity(intent);