I want to clear the backstack when I start a new intent.
The exact case of my problem is as follows: I have actions like this A> B> C> D> E "A" is the registration, and "B" is the registration confirmation. I want that when user βBβ starts, that he can no longer return to activity βAβ, also when the user reaches activity βCβ, both operations βAβ and βBβ will be useless, I do not need the user returns to him more.
Also, when the user proceeds to action βDβ with βCβ, he can return to βCβ, but if he moves further to βEβ, he will not be able to return to any of the previous βCβ, or βDβ "
After a lot of research, the best I got was to use the flag: FLAG_ACTIVITY_NO_HISTORY , but I have two problems for my case:
- Under action "A", if the user goes from my application (for example, to the main screen), he destroys this action and, therefore, all the information that the user enters is lost!
- Activity "C" I want to save it in history (backstack) if the user goes to activity "D", but when the user goes to "E", I want to delete it.
I canβt find a solution to this problem so far, I think it would be easier if there was something to clear the back of the current task!
My minimum SDK support is 5.
Thanks in advance.
source share