APP1:
Intent tIntent = new Intent();
ComponentName tComp = new ComponentName("com.example.newporject"(另外一个应用包名), "com.example.newporject.NextActivity"(另外一个应用包名+窗口名));
tIntent.setComponent(tComp);
// tIntent.setAction("android.intent.action.MAIN");
tIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(tIntent);
<activity
android:name="com.example.next.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="com.example.next.MainActivity" />
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
记得要加权限:
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
APP2:
<activity
android:name=".NextActivity"
android:label="@string/title_activity_next" >
<intent-filter>
<action android:name="com.example.newporject.NextActivity" />
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>