I am working on an application that has Activities A and B. If I navigate from A -> B, background the app then foreground the app Activity B is destroyed and I am brought back to Activity A.
Initially I thought that this was an issue of the Activity B's state not being restored when the app was brought into the foreground but after implemented onSavedInstanceState()/onRestoreSavedInstanceState() I am still seeing this issue.
Placing a breakpoint in the Activity B's onDestroy() shows that the ActivityThread.handleDestroyActivity() is being called immediately when the app is foregrounded without an attempt to restore the activity.
I am currently using android:LaunchMode="singleTask"
in the AndroidManifest for ActivityA and android:LaunchMode="standard"
for ActivityB. ActivityB is being launched from Fragment on ActivityA.
Does anyone know why Acitivty B does not persist after the app is backgrounded and foregrounded?