问题
I was looking for a way to delete a certain activity from history stack, and found a solution here (Wakkas's anwer). However, if I close the app with this activity opened e.g. by pressing the home button, and later return to it, the activity is not restored.
If I remove the "noHistory" attribute, it is coming back and also restored after a kill.
Is there a way to make it not appear on the history stack (= don't want to come back to it by pressing the back button in next activity) without this behavior?
Kind regards, jellyfish
回答1:
I don't think so - leaving the activity via the "Home" button and opening a new activity will have the same effect: if your activity is not in the history stack, it should not be restored.
Instead of using the "noHistory" attribute, couldn't you just call finish() as you launch your next activity? It should not re-appear when you then hit the "back" button.
来源:https://stackoverflow.com/questions/6045558/android-how-to-return-to-activity-with-nohistory-attribute-after-onstop