You can use a global static boolean value to help you with this (in the SomeClass.IsClosingFlow example). In addition, you must define each action for a “mark” if it is in a “stream” (stream = means its part of the action package, to be closed). I recommend using this label as an abstract method if all your actions extend some abstract actions (i.e. isActivityInFlow() ).
The following code demonstrates this. This should be a place in the onResume() each action in the application:
// Check to see if we are in the process of closing activities if (SomeClass.IsClosingFlow){ if (isActivityInFlow()){ this.finish(); } else{ // If we got here, and we're not in the flow anymore SomeClass.IsClosingFlow = false; } }
source share