My app has two activities: A and B. A - is the main activity (default for launch), it has action android.intent.action.MAIN
and category android.intent.category.LAUNCHER
, and A activity has overridden lanchMode="singleTop"
, it means that if we trying to launch activity A and A is not the top of the task, then OS will create a new instance of A and put it on top.
Steps:
- launch activity A from apps menu (click on the app icon)
- click the button in activity A screen to launch B (now activity stack looks like A -> B)
- press the home button to see the apps menu again and to minimize the app
- click on the app icon again to launch my app
Result: opened activity B (stack looks like A -> B)
So my question is why OS do not create a new instance of A if my app in the background with task stack looks like A -> B (B places on top, A and B not finished, they in onStop state) and just open the current stack when I tap on app icon from apps menu (that tap send the intent to my app with Launcher intent, and Launcher is described in activity A which has launch mode singleTop)
I think it suppose to open new instance of A (with stack A -> B -> A) because of A has lanchMode="singleTop"
. Seems like if the app had activities in the background (in onStop
state) and it was opened with the same intent as the first time, then Android OS just show the current app task, but I can not find any proof of that.