所谓隐式意图就是在意图激活Activity、Service或BroadcastReceiver这三类组件时,并不显示指出需要显示指出主键的名字,而是通过指定action,data,category,Android系统会根据这三个特征找到最合适的组件并激活。先看自定义的例子
[html]
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".MainActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".OtherActivity1" android:label="@string/app_name">
<intent-filter>
<action android:name="cn.xy.action" />
<category android:name="android.intent.category.DEFAULT"></category>
</intent-filter>
</activity>
<activity android:name=".OtherActivity2" android:label="@string/app_name">
<intent-filter>
<action android:name="cn.xy.action2" />
<action android:name="cn.xy2.action2" />
<category android:name="cn.xy.category2"></category>
<category android:name="cn.xy2.category2"></category>
<category android:name="android.intent.category.DEFAULT"></category>
</intent-filter>
</activity>
<activity android:name=".OtherActivity3" android:label="@string/app_name">
<intent-filter>
<action android:name="cn.xy.action3" />
<category android:name="cn.xy.category3"></category>
<data android:scheme="xy" android:host="www.xy.cn" android:path="/xy"></data>
<category android:name="android.intent.category.DEFAULT"></category>
</intent-filter>
</activity>
<activity android:name=".OtherActivity4" android:label="@string/app_name">
<intent-filter>
<action android:name="cn.xy.action4" />
<category android:name="cn.xy.category4"></category>
<data android:scheme="xy" android:host="www.xy.cn"></data>
<data android:mimeType="image/*"/>
<category android:name="android.intent.category.DEFAULT"></category>
</intent-filter>
</activity>
</application>
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".MainActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".OtherActivity1" android:label="@string/app_name">
<intent-filter>
<action android:name="cn.xy.action" />
<category android:name="android.intent.category.DEFAULT"></category>
</intent-filter>
</activity>
<activity android:name=".OtherActivity2" android:label="@string/app_name">
<intent-filter>
<action android:name="cn.xy.action2" />
<action android:name="cn.xy2.action2" />
<category android:name="cn.xy.category2"></category>
<category android:name="cn.xy2.category2"></category>
<category android:name="android.intent.category.DEFAULT"></category>
</intent-filter>
</activity>
<activity android:name=".OtherActivity3" android:label="@string/app_name">
<intent-filter>
<action android:name="cn.xy.action3" />
<category andr
补充:移动开发 , Android ,