Android - 意图解析规则 - 行动和类别

时间:2014-06-24 08:00:31

标签: 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" />
   <category android:name="com.android.testApp.app.testCategory" />
</intent-filter>

意图解析规则规定,如果intent不包含任何操作,只要意图过滤器包含至少1个操作,它就可以通过操作测试。

此外,意图过滤器中必须存在意图中的所有类别。

我创建了以下意图:

 Intent intent = new Intent();
 intent.addCategory("com.android.testApp.app.testCategory");
 startActivity(intent);

但是,此意图无法通过intent过滤器。有人能指出原因吗?

0 个答案:

没有答案