Learning Android Development
Android Activity LaunchMode Made Simple
Understand when to use which activity launch mode.
When we declare our Activity in AndroidManifest.xml, there’s a little attribute we can set, which is launchMode
. It has 4 possible settings i.e. standard
, singleTop
, singleTask
and singleInstance
.
E.g.
<activity android:name=".MyActivity"
android:launchMode="standard" />
If you are using a single Activity App, these don’t matter. But if you have multiple activities in your app, you might want to know what.
A great illustration is provided at https://iammert.medium.com/android-launchmode-visualized-8843fc833dbe. But I still have questions about some other combinations of launch, hence I make an App that I can just demo any combination.
With a clear understanding of how each works, let me describe and make it simple for all.
Standard launch mode
This is the default when no launchMode
is set. Its behavior is simply just launched a new activity every time it is…