Launch Modes — Android
2 min readSep 12
--
- Single top:
This launch mode is similar to the standard mode, but if an instance of the activity already exists at the top of the stack, Android will not create a new instance of the activity. Instead, Android will route the intent to the existing instance by calling its onNewIntent() method. - Single task:
This launch mode creates a new task and places the activity at the root of the task. If an instance of the activity already exists in a task, Android will route the intent to that task. If the activity is not in the task, Android will create a new instance of the activity in a new task. - Standard (Default):
This launch mode creates a new instance of the activity each time an intent is received, regardless of whether an instance of the activity already exists in the stack. - Single Instance:
This launch mode is similar to the single task mode, but the activity is the only activity in the task. If any other activity is launched with an intent, a new task will be created for that activity. - Single Instance per task:
This launch mode is similar to the single instance mode, but allows multiple instances of the activity to be created in different tasks.
Note: These launch modes can also be set programmatically using the setLaunchMode() method in the Activity class.