Intents, Tasks, and Launch Modes
Up until now, you have been using the standard behavior for creating Activities and moving from one Activity to the next. When you open the app from the launcher with the default behavior, it creates its own Task, and each Activity you create is added to a back stack, so when you open three Activities one after the other as part of your user’s journey, pressing the back button three times will move the user back through the previous screens/Activities and then go back to the device’s home screen, while still keeping the app open.
The launch mode for this type of Activity is called Standard
; it is the default and doesn’t need specifying in the Activity element of AndroidManifest.xml
. Even if you launch the same Activity three times, one after the other, there will be three instances of the same activity that exhibit the behavior described previously.
For some apps, you may want to change this behavior so the same instance is...