Hi I’m writing an app that has multiple activities. Right now it starts at the home screen, then when the user presses a button it starts a new activity and goes to another screen, then the user enters in information and presses a button to start another activity and another screen.
I have a menu setup so that from whatever the activity the user is in they can get back to the home screen. What I want it to do is kill all the current activities and just take the user right back to the home screen, so there is only one activity running again. How can I do this?
I figured it out. If you add
myIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);then when you runstartActivity(myIntent);it clears all activities except the one myIntent is starting.