Android: bug in launchMode=”singleTask”? -> activity stack not preserved

This is not a bug. When an existing singleTask activity is launched, all other activities above it in the stack will be destroyed. When you press HOME and launch the activity again, ActivityManger calls an intent {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER]flag=FLAG_ACTIVITY_NEW_TASK|FLAG_ACTIVITY_RESET_IF_NEEDED cmp=A} So the result is A > B > HOME > A. It’s different when A’s launchMode … Read more

How to prevent multiple instances of an Activity when it is launched with different Intents

Add this to onCreate and you should be good to go: // Possible work around for market launches. See https://issuetracker.google.com/issues/36907463 // for more details. Essentially, the market launches the main activity on top of other activities. // we never want this to happen. Instead, we check if we are the root and if not, we … Read more

tech