All about Android activity flags.
Android activity flags specify:
In all cases, when an activity is reused, ''onNewIntent'' is called.
Flags can be specified in both the manifest and intent. In all cases, the Intent flag will override the manifest setting.
The activity will be created (even if other instances are running). It will be placed on top of the current task stack. This is the default launch mode.
The activity is reused only if it is on top of the target task stack. Otherwise it is created on the target task stack. Essentially it is the same as standard unless it is already on top.
Can also be specified by using the intent flag Intent. FLAG_ACTIVITY_SINGLE_TOP.
The activity will be reused if it currently exists by switching to its task and terminating all activities that are stacked above it. If not found, it will be launched in a new task.
Can also be specified by using the intent flag Intent.FLAG_ACTIVITY_NEW_TASK.
The activity will be reused if it currently exists by switching to its task. No other activities will be placed on the task. New instances will be started in a new task. This new task will allow no more activities to be placed on it.
By default the affinity of the activity is the affinity of the application, and by default, that is the package name.
When you call startActivity() to transition from one Activity to another, if you do not set Intent.FLAG_ACTIVITY_NEW_TASK in the Intent flags, the new Activity will be started in the same task, regardless of the value of taskAffinity.
However, if you set Intent.FLAG_ACTIVITY_NEW_TASK in the Intent flags, the new Activity will still be started in the same task if the new Activity has the same taskAffinity as the taskAffinity of the task (this is determined by the taskAffinity of the root Activity in the task). But, if the new Activity has a different taskAffinity, the new Activity will be started in a new task.
FLAG_ACTIVITY_MULTIPLE_TASK causes FLAG_ACTIVITY_NEW_TASK to always start a new task and skip the search.