My app has four activities; MainActivity, ListActivity1 (L1) , ListActivity2 (L2), ListActivity3 (L3). From Main, the user goes down to L1 by clicking a button. After selecting an item in L1, user comes to L2 and then L3 after selecting an item in L2. In L3, when selecting an item a Yes/No-toast is launched. If user selects “No”, user stays on L3. If user selects “Yes”, user returns way back to Main.
Here’s the question: If the user selects “yes” taking him to Main and pressing Back button, he returns to L3. What I want is that if the user has walked down to L3, selected yes and returned to Main, pressing Back should take him to Home screen. I.e. I want to delete the “back trace” to L3.
How do I accomplish this?
(Main and the ListActivities starts the new activity with startActivity(new Intent(foo, Bar.class)))
You could do something like this when yes is selected:
This will clear the activity stack so L1, L2, and L3 are removed and the existing MainActivity is started with the new intent.