In my application there are many actions that can be called in any order
Example operation history: A โ B โ C โ D โ A โ B โ E
Now in step E, I โunregisterโ the device (by registering the user and deleting any data that they could download to their SD card). The behavior of the desire is that the application "starts", and the user is prompted to activate the input activity, and clicking on it returns the user to the main screen.
So now, activity E must somehow clear the activity stack. I am currently setting FLAG_ACTIVITY_CLEAR_TOP when starting an intent with E. The problem is that when the user visited A and then switched to intermediate actions and moved to A before moving to E, there are still actions on the stack.
A โ B โ C โ D โ A
Thus, the user is logged out and cannot use the BD actions, but if the user deviates from activity A, they can access the BD actions. Is there an easy way for all actions except login activity to be removed from the stack?
Update:
So, I tried updating my BaseActivity (every action in subclasses of my application) to contain a static isDeregistering flag that tells the activity to destroy itself if true. The problem is that every action calls finish (), and I boot to the desktop and cannot restart the application until I forcefully close the application. Is there a better way to do this?
source share