Question

In my app I have couple activities. How to setup that every time user long press home and bring from background my app it display always main activity?

Cause right now if user hide the app and log press "home" button, my app coming back to the latest open activity, but then user press "back" button it close app, but than press app icon it coming back to main activity.

Was it helpful?

Solution

If you want only your main activity to be in visible your "recent apps", then in all your non-main activities, add this flag in your manifest:

android:noHistory

This will cause your main activity to remain on the activity stack, but remove all your activities from it.

http://developer.android.com/guide/topics/manifest/activity-element.html#nohist

Whether or not the activity should be removed from the activity stack and finished (its finish() method called) when the user navigates away from it and it's no longer visible on screen — "true" if it should be finished, and "false" if not. The default value is "false". A value of "true" means that the activity will not leave a historical trace. It will not remain in the activity stack for the task, so the user will not be able to return to it. This attribute was introduced in API Level 3.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top