I would like to launch always a specific activity, not this which was active during closing application. I don't have possibility switching to desirable activity before closing, because it could be dead.
I would prefer even delete shortcut to whole program from recent app than make user confused by launch credits instead of start splash screen. However this would be only workaround (but just in case, how can I do that?)
I decompiled some apps and found their solution:
About android:taskAffinity:
The correct way to solve this is to add
to the manifest entry for all activities except for the main (root)
Activity
.When the user returns to your application, either from the list of recent tasks or by pressing the app icon on the HOME page, all activities (except for the main (root)
Activity
) will be removed from the task (actually, they get removed immediately when the user navigates away from the app by pressing the HOME button, answering an incoming phone call, choosing another app from the Notification bar, etc.One way you can achieve this would be to mark all your activities with
android:excludeFromRecents="true"
attribute. this would ensure that none of your activities shows in the Recent Applications list.You should also look into the
android:finishOnTaskLaunch
andandroid:stateNotNeeded
attributes.If you mean you want to start your application through the same activity every time, add
to your main activity in the manifest file. This will force your application to put this activity at the bottom of the activity stack clearing all other activities which may have been running.