Possible duplicate:
Removing activity from the history stack
I am looking for a solution to remove StartActivity from the history stack. StartActivity is the one that starts at the beginning. I use this class to check some user values ββand want to redirect the user to MainActivity if everything is correct.
I tried to set the flag:
addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
but it does not do what is needed.
App starts -> StartActivity -> MainActivity -> PRESS back -> the app should end
he does:
App starts -> StartActivity -> MainActivity -> PRESS back -> StartActivity
Thank you for your help!
Edit: this is the code I use to run MainActivity:
Intent i = new Intent(context, DashBoardActivity.class); i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(i);
android
Mark
source share