When starting activity, Android will put the new activity on the top of task stack. Upon returning, Android removes the stack top.

Note that, for an activity, even if the stack contains its instance, Android will still create a new one and put it onto stack top. This is the standard mode of activity creation.

We can change this behaviour by setting the attribute android:launchMode of tag <activity> in AndroidManifest.xml. Several other options include:

  • singleTop
  • singleTask
  • singleInstance