views:

42

answers:

1

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
How would I call `finish()` on them? I don't have references to them.
Daniel A. White