Skip to content

Instantly share code, notes, and snippets.

@mddhananjay
Last active August 30, 2016 08:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mddhananjay/6b4374a5937bc7597b340eabd9fc0c55 to your computer and use it in GitHub Desktop.
Save mddhananjay/6b4374a5937bc7597b340eabd9fc0c55 to your computer and use it in GitHub Desktop.
Activity Launch Modes
"standard" (the default mode)
Default. The system creates a new instance of the activity in the task from which it was started and routes the intent to it.
The activity can be instantiated multiple times, each instance can belong to different tasks, and one task can have multiple
instances.
"singleTop"
If an instance of the activity already exists at the top of the current task, the system routes the intent to that instance
through a call to its onNewIntent() method, rather than creating a new instance of the activity. The activity can be
instantiated multiple times, each instance can belong to different tasks, and one task can have multiple instances
(but only if the activity at the top of the back stack is not an existing instance of the activity).
Note: When a new instance of an activity is created, the user can press the Back button to return to the previous activity.
But when an existing instance of an activity handles a new intent, the user cannot press the Back button to return to the
state of the activity before the new intent arrived in onNewIntent().
"singleTask"
The system creates a new task and instantiates the activity at the root of the new task. However, if an instance of
the activity already exists in a separate task, the system routes the intent to the existing instance through a call
to its onNewIntent() method, rather than creating a new instance. Only one instance of the activity can exist at a time.
Note: Although the activity starts in a new task, the Back button still returns the user to the previous activity.
"singleInstance".
Same as "singleTask", except that the system doesn't launch any other activities into the task holding the instance.
The activity is always the single and only member of its task; any activities started by this one open in a separate task.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment