I have an android project with a bunch of nested activities :-
Main --- Page 1 --- Page 2 --- Page 3
Main calls page 1. Page 1 can call page 2 or go back to main. Page 2 can call page 3 or go back to page 1. Page 3 can only go back to Main. On returning to main all the other activities have to closed, not hidden.
Now after hours of searching the usual suggestion is Intent.FLAG_ACTIVITY_CLEAR_TOP. This doesn't do what I want though, as it seems to hide the activities, and bring Main to the front, rather than close them and leave only Main open.
Is there a way I can get Page 3 to CLOSE Page 1, 2 and 3, and leave just Main open?
Maybe have a look at Broadcast Listeners: Finish an activity from another activity
It'd probably use the least resources when you finish your page 2 when creating page 3 and at the same time broadcast to your page 1 to finish. This way you might also prevent hiccups when going back from page 3 while page 1 and 2 are finishing.