As @Mudassir said, start the action [A]. When you call [B], just use FLAG to clear all the data, but [B], and then you can call [D] without the flag from [B], having [B] [D], how would you like? Then press the back button to go from [D] to [B], without any other data ?. It doesn't seem like you think he wants you to call [B] the flag from [D], and what would be the purpose of this? At this point, you will end with just [B].
- In any case, you lose [C] along the way. The solution may be:
startActivity(A)
[in activity A] startActivity(B) - WITH CLEAR_TOP TO KILL [A]
[in activity B] startActivityForResult(C) - WHEN [C] IS finish() IT WILL COME BACK TO [B]
[in activity B, onActivityResult()] startActivity(D)
This will give you JUST [B] and [D], while it still comes to [C] .... try, it will work.
source
share