Ada*_*ile 4 android android-intent
试图在android中查看意图和动作并查看文档.但我一直看到的是一个定义了多个动作的intent过滤器.像这样,从上面的链接:
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<action android:name="android.intent.action.EDIT" />
<action android:name="android.intent.action.PICK" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="vnd.android.cursor.dir/vnd.google.note" />
</intent-filter>
Run Code Online (Sandbox Code Playgroud)
但是,如果您调用该活动,它如何选择选择哪个操作?
就此而言,链接到示例的多个活动都包含相同的操作,例如"android.intent.action.VIEW".使用内容调用此内容时://com.google.provider.NotePad/notes如何知道要使用哪个活动?
Com*_*are 15
但是,如果您调用该活动,它如何选择选择哪个操作?
该Intent
有动作.如果该操作与Intent
过滤器中的三个中的一个匹配,并且在类别上匹配,并且匹配MIME类型,那么它将与Intent
整体过滤器匹配并将启动活动.
换句话说,多个动作(或任何其他元素)是逻辑OR.
就此而言,链接到示例的多个活动都包含相同的操作,例如"android.intent.action.VIEW".
通常,Intent
过滤器中有一些东西可以区分不同的东西.
使用内容调用此内容时://com.google.provider.NotePad/notes如何知道要使用哪个活动?
它询问内容提供商,"哟,dawg - 这是什么MIME类型,哟?".给定内容提供者的MIME类型,它可以找到任何匹配的Intent
过滤器.
归档时间: |
|
查看次数: |
6055 次 |
最近记录: |