Android Activity Launch Modes

  • singleTop
    — Similar to the previous one but it differs in a scenario when the activity that we want to launch has already existed and it’s on the top of the back stack.
    Instead of creating a new instance of the requested activity, the android system will use the existing activity that’s on the top of the back stack.
    — If the activity does/do not exist and it’s not on the top of the back stack, the Android system will create a new instance of that activity.
  • singleTask
    when the activity is launched with singleTask mode, it will initiate its own task and back stack
    — If the Activity exists in a different task, the system will route to the existing task by utilizing its onNewIntent() method, hence a new task/back stack will not be created. Only one instance of this activity will be created.
  • singleInstance
    Same as the previous one, but the newly created task cannot launch other activities. So only that instance of the activity exists in the task/back stack.

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Android app startup time: why we care

YOLOv4 on Android TFLite (Without Tears)

The right way to get a result. Part 2. Fragment Result API

FLUTTER CALCULATOR

Creating AppImage with Flutter

7 most important tips to Impeccable Android App Development

The importance of USB SuperSpeed for Android Development

Android Click Debounce

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Hari Prasad

Hari Prasad

More from Medium

Integration of HMS Scene Kit and AR Engine

google maps display using android java

Mobile App Security Primer

Resolving HAXM Issue in Android Studio for Windows