I have four activities a,b,c,d. Activity a is the main activity which then calls b,c and d which then does some computation. I know I can prevent the activity from building up in my application by android:noHistory="true" attribute in those activites . But the issue is if I am in activity c,when I press the back button I want to go to b, but if d finishes I want b and c to be removed and only a to displayed. Is there any way to achieve this?
I have four activities a,b,c,d. Activity a is the main activity which then calls
Share
Put this code in each of your activities, changing it slightly each time. That way you override the back button’s normal function
Also, if you are only supporting android 2.0+ then you can use this
Just put either of these in each of your activities, then start the correct activity
To close one specific activity, look at this page – How to clear specific activity from the stack history?