Android kill all other activities on starting a new one

Viewed 6158

I have an android activity problem.

Here is how my process works:

  1. Login Activity starts
  2. Login successful. MainMenuActivity starts and LoginActivity is finished by me.
  3. User touched on settings and SettingsActivity starts. MainMenuActivity is NOT finished. because is it the main menu. when user presses the back on settings screen I need to go back MainMenuActivity. so I cant kill MainMenu.
  4. User touched on log out and SettingsActivity is finished by me and Login activity starts. As user returns the login I need to kill MainMenuActivity but I cant.:/
  5. I tried FLAG_ACTIVITY_SINGLE_TOP, CLEAR_TOP, SINGLE_TASK, NEW_TASK, NO_HISTORY etc.. almost all of them didnt work
  6. I put launchMode="singleTask", clearTaskOnLaunh="true" etc. didtn work again.
  7. I tried addFlags() and setFlags() both, didnt work
  8. There are some many issues about this topic here, I read and applied all the suggested solutions and didnt work.

Can anyone help, please?

P.S android:minSdkVersion="8" and android:targetSdkVersion="15" for my app. I didnt use fragments in the app, I use old activity structure.

5 Answers
Related