第二个Activity里的东西就是我们自定义设置的,就是下边的这段代码:
- <activity android:name="net.loonggg.intent.SecondActivity" > <intent-filter>
- <!-- 自定义的动作 --> <action android:name="net.loonggg.xxx" />
- <!-- 自定义的scheme和host --> <data
- android:host="www.baidu.com" android:path="/person"
- android:scheme="loonggg" /> <!-- 自定义的类型 -->
- <data android:mimeType="person/people" /> <!-- 附加信息 -->
- <category android:name="android.intent.category.DEFAULT" /> </intent-filter>
- </activity>
那在代码中怎么调用自定义的呢?其实跟调用系统短信一样,只不过调用系统短信里的那些动作和数据,系统已经给我们配置好了,我们直接用就行,而自定义的就是我们自己写的,调用方法和系统其实是一样的。方法如下:
- /** * 通过自定义的隐式意图启动
- * * @param view
- */ public void startTwo(View view) {
- Intent intent = new Intent(); intent.setAction("net.loonggg.xxx");
- intent.addCategory("android.intent.category.DEFAULT"); intent.setDataAndType(Uri.parse("loonggg://www.baidu.com/person"),










