<intent-filter>
<action android:name="com.syy.note.a"/>
<action android:name="com.syy.note.b"/>
<category android:name="com.syy.category.c"/>
<category android:name="com.syy.category.d"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="text/plain"/>
</intent-filter>
アクション
一致ルール:フィルター内のアクション属性の1つが存在する必要があり、一致する必要があります。
カテゴリー
マッチングルール:
存在しない場合もありますが、存在しない場合は「android.intent.catetory.DEFAULT」と一致するため、<intent-filter>を構成する場合、category属性には「android.intent.catetory.DEFAULT」が必要です。
存在する場合は、フィルターのカテゴリー属性の1つと一致する必要があります。
データ
一致ルール:フィルター内のデータ属性を持っている必要があり、一致している必要があります。データ構文は次のとおりです。
<data android:scheme="string"
android:host="string"
android:port="string"
android:path="string"
android:pathPattern="string"
android:pathPrefix="string"
android:mimeType="string" />
データは、mimeTypeとURIの2つの部分で構成されます。mimeTypeは、image / jpeg、vidio / *などのメディアタイプを参照します。URI構造:
<scheme>://<host>:<port>/[<path>|<pathPrefix>|<pathPattern>]
setDataAndTypeメソッドを使用してインテントのデータを指定します。
intent.setDataAndType(Uri.parse("file://abc"),"image/png");
要約すれば
記事の冒頭で、それに一致するインテントをインテントフィルターに与えることができます。
Intent intent = new Intent("com.syy.note.a");
intent.addCategory("com.syy.category.c");
intent.setDataAndType(Uri.parse("file://abc"),"text/plain");
startActivity(intent);