Activity launch modes: Android

Task Affinity

<activity android:name=".ActivityD"
android:launchMode="singleTask"
android:taskAffinity="com.affinity.of.a"/>
<activity android:name=".ActivityC"
android:taskAffinity="com.affinity.of.c"
android:launchMode="singleTask"/>
<activity android:name=".ActivityB"
android:taskAffinity="com.affinity.of.b"
android:launchMode="singleTask"/>
<activity android:name=".ActivityA"
android:taskAffinity="com.affinity.of.a"
android:launchMode="singleTask"/>
  1. Standard
  2. Single Top
  3. Single Task
  4. Single Instance

Standard launch mode

Single Top launch mode

Single Task launch mode

  1. What if we don't have any instance of this activity in a stack?

Single Instance launch mode

  1. What if we don’t have any instance of this activity in the different stack?

Working remotely as Android Developer

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

Recommended from Medium

Android 11- Top New 11 features for android.

Sending app updates to a slack channel

How to Disable Chromecast on Android

Navigation in android multi-module project

How to show first letter of user first name and last name first letter in TextView Android Kotlin?

Android Jetpack Compose Explained

How to improve the debugging experience with Android Studio Logcat?

Android MVI Architectural Pattern

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
Gaurav Rajput

Gaurav Rajput

Working remotely as Android Developer

More from Medium

Multiple Image Selecter in android studio with Matisse

Realm Relationships: From Mobile to MongoDB Atlas

Jetpack compose custom rating bar in android 2022

Android Test and Compose Test on Android 12