- Create a process global variable (boolean (false when creating the main activity))
- Set the variable to TRUE when clicking your exitbutton
Additional use Activity.finish
In EACH Activity (in Activity resume) check the boolean if it is true. starting in your main activity.
If it is true then call Activity.finish.
If it is false then you can use the activity like normal...
Asuming you go from main to act2 to act 3 to act4 to act5
Normally you would use back key to go back to act4 (and leaving act5)
Then you would use back key to go back to act3, then go back to act2 and then back to main.
Now (using the new global var)
You press the button in act5. Activity.finish is called in your buttonsub and the global var is set to TRUE
Android will go back to your act4. Here you have the new check in activity_resume. Note the global var is TRUE here... Activity.finish is called
Android will go back to your act3. Here you have the new check in activity_resume. Note the global var is TRUE here... Activity.finish is called
Android will go back to your act2. Here you have the new check in activity_resume. Note the global var is TRUE here... Activity.finish is called
Android will go back to your main activity. Here you have the new check in activity_resume. Note the global var is TRUE here... Activity.finish is called and your app will be terminated cause you closed all activities.
Never tried this but theoretical it should work like this.