I'm switching between different Activities using Intents. For one Activity, I would like it to clear the history stack so when the user presses the back button, it takes them Home instead of previous activities in my application.
A:
You could try calling finish()
on the activities you don't want to keep around when calling startActivity
?
Or, the less android solution, listen for onBackPressed()
in your activities and then call startActivity()
on your main activity with the CLEAR_STACK
flag set.
Falmarri
2010-10-14 17:58:02
How would I call `finish()` on them? I don't have references to them.
Daniel A. White
2010-10-14 18:12:42