赞
踩
<action>
<category>
<data> 通过URI描述
- <activity android:name=".OtherActivity">
- <intent-filter >
- <action android:name="com.example.zx"/>
- <category android:name="com.example.category.java"/>
- <category android:name="android.intent.category.DEFAULT"/>
- <data android:scheme="xxx" android:host="www.xxx.com" android:path="/xxx"/>
- <data android:mimeType="image/*"/>
- </intent-filter>
- </activity>
- Intent intent = new Intent();//隐式意图激活Activity
- intent.setAction("com.example.zx");
- intent.addCategory("com.example.category.java");
- intent.setDataAndType(Uri.parse("xxx://www.xxx.com/xxx"), "image/jpeg");
-
- startActivity(intent);//方法内部为Intent添加了android.intent.category.DEFAULT类别
AndroidManifest.xml
- <?xml version="1.0" encoding="utf-8"?>
- <manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.example.mulactivity"
- android:versionCode="1"
- android:versionName="1.0" >
-
- <uses-sdk
- android:minSdkVersion="19"
- android:targetSdkVersion="19" />
-
- <application
- android:allowBackup="true"
- android:icon="@drawable/ic_launcher"
- android:label="@string/app_name"
- android:theme="@style/AppTheme" >
- <activity
- android:name="com.example.mulactivity.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>
- <intent-filter >
- <action android:name="com.example.zx"/>
- <category android:name="com.example.category.java"/>
- <category android:name="android.intent.category.DEFAULT"/>
- <data android:scheme="xxx" android:host="www.xxx.com" android:path="/xxx"/>
- <data android:mimeType="image/*"/>
- </intent-filter>
- <activity
- android:name="com.example.mulactivity.OtherActivity"
- android:label="@string/title"
- />
-
- </application>
-
- </manifest>

- public class IntentActivity extends Activity {
- /** Called when the activity is first created. */
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.main);
- }
-
- public void openActivity(View v){
- Intent intent = new Intent();//隐式意图激活Activity
- intent.setAction("com.example.zx");
- intent.addCategory("com.example.category.java");
- intent.setDataAndType(Uri.parse("xxx://www.xxx.com/xxx"), "image/jpeg");
-
- startActivity(intent);//方法内部为Intent添加了android.intent.category.DEFAULT类别
- }
- }

赞
踩
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。