What does the flag FLAG_ACTIVITY_NEW_TASK do here?
Intent in = new Intent();
It will start a new activity with matching intent filter, in a new task always.
It will start a new activity with matching intent filter, in a new task only if that corresponding task is not in memory now.
It will start a new activity with matching intent filter, in old task always. here old task means task in which the current activity is running which has started new activity.
This will start a new activity in a new task, where only this activity will be there in that task and no other components. if at all new components are launched from this new activity, they will be launched in a different task.
Description from developer android documentation:
If this flag is set, then this activity will become the start of a new task on this history stack.
When using this flag, if a task is already running for the activity you are now starting, then a new activity will not be started; instead, the current task will simply be brought to the front of the screen with the state it was last in.
Back To Top