I have a login view at the start of my application. On logging in this view is finished manually (i.e. finish() is called in the code). This is so that the user doesn't have to press the back button past the login page when they want to exit the app.
Now I want to have a logout button in the app. This calls the login view (with an intent to remove any previously stored login credentials - i.e. simulating a logout).
What I need to do is clear the backwards navigation stack on this intent, or else the user will still be able to press back and view the application as they navigated it originally.
Now, Intent.FLAG_ACTIVITY_CLEAR_TOP doesn't work, I presume because I finish() the Login activity meaning that that activity isn't in the back stack. I am also using Intent.FLAG_ACTIVITY_NEW_TASK which doesn't seem to work either. User's can still press the back button and navigate backwards through activities they should be logged in to access.
So what I need to do is create an instance of the Login activity and make this the new root activity of my application.
How can I do this?
Thanks