<activity android:name=".export.LiveChannelListActivity" android:configChanges="orientation|keyboardHidden|screenSize" android:launchMode="singleTask" android:screenOrientation="landscape" />
public static void start(Context context) { Intent starter = new Intent(context, LiveChannelListActivity.class); starter.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK|Intent.FLAG_ACTIVITY_CLEAR_TOP); context.startActivity(starter); }
1. FLAG_ACTIVITY_NEW_TASK:
Call several times to open several Activity instances
2. FLAG_ACTIVITY_NEW_TASK|FLAG_ACTIVITY_CLEAR_TOP
Each call opens to create a new Activity instance, and destroys the old one
3. FLAG_ACTIVITY_NEW_TASK 设置launcheMode = singleTask
Repeated calls will no longer create a new Activity instance. The onNewIntent callback of an Activity has been created. If you want to reuse an existing instance, you should use this method.
4. FLAG_ACTIVITY_NEW_TASK|FLAG_ACTIVITY_CLEAR_TOP 设置launcheMode = singleTask
Same as 3. That is to say, if launcheMode = singleTask is set, it doesn't matter if FLAG_ACTIVITY_CLEAR_TOP is set or not.
5. If FLAG_ACTIVITY_NEW_TASK is not set, Activity cannot be started from Service, to be verified