'How to remove all but one activity from the stack?
I have activities like A, B, C Then I want to remove B, C and add D as a one after A (so that when we click BACK in D, we go to A).
How can I do it? Flags do not work, as they clear all, including A.
Solution 1:[1]
you can also finish the activity when you leave them... eg when you navigate from B -> C, you can finish activity B by calling finish() after intent.. and do the same with C -> D.. so when you press back on D.. you will directly go to A
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Saksham Khurana |
