Possible Duplicate:
Removing an activity from the history stack
I am looking for a solution to remove the StartActivity from the history stack. The StartActivity is the one that is being started at the beginning. I am using this Class to check some user values and want to redirect the user to the MainActivity if all is correct.
I have tried to set a flag:
addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
but this does not do what it should.
App starts -> StartActivity -> MainActivity -> PRESS back -> the app should end
it does:
App starts -> StartActivity -> MainActivity -> PRESS back -> StartActivity
Thank for your help!
Edit: This is the code i am using to start the MainActivity:
Intent i = new Intent(context, DashBoardActivity.class);
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(i);