Android Tasks and Back Stack

activity:launchMode in the AndroidManifest.xml

Image for post
Image for post
The back stack — from Android Developer
Image for post
Image for post
TasksAndBackStackSample

Prerequisites

activity:launchmode

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.launchmode.example">
<application ...>
<activity
android:name=".launchmode.LaunchModeStandardActivity"
android:launchMode="standard" />
</application>
</manifest>

Four launch mode

android:launchMode=”standard”

Image for post
Image for post
android:launchMode=”standard”, click [A] > [A] > [A]

android:launchMode=”singleTop”

Image for post
Image for post
android:launchMode=”singleTop”, click [B] > [A] > [B] > [B]
Image for post
Image for post
android:launchMode=”singleTop”, click [B] > [B]

android:launchMode=”singleTask”

Image for post
Image for post
android:launchMode=”singleTask”, click [C] > [C]
Image for post
Image for post
android:launchMode=”singleTask”, click [C] > [A] > [A] > [B] > [C]

android:launchMode=”singleInstance”

Image for post
Image for post
android:launchMode=”singleInstance”, click [D] > [D] > [A] > [D]

An Android/Flutter engineer at Line Corporation.

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