I have an android activity problem.
Here is how my process works:
Login Activitystarts- Login successful.
MainMenuActivitystarts and LoginActivity is finished by me. - User touched on settings and SettingsActivity starts.
MainMenuActivityis NOT finished. because is it the main menu. when user presses the back on settings screen I need to go backMainMenuActivity. so I cant killMainMenu. - User touched on log out and
SettingsActivityis finished by me and Login activity starts. As user returns the login I need to killMainMenuActivitybut I cant.:/ - I tried
FLAG_ACTIVITY_SINGLE_TOP,CLEAR_TOP,SINGLE_TASK,NEW_TASK,NO_HISTORYetc.. almost all of them didnt work - I put
launchMode="singleTask",clearTaskOnLaunh="true"etc. didtn work again. - I tried
addFlags()andsetFlags()both, didnt work - 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.
I suggest that you don't finish the
Loginactivity when you start the main menu. Then you can always clear all activities on logout by doing this:This will only work if
Loginactivity is still active at the root (beginning) of the task stack.To prevent the user from BACKing into the
Loginactivity from theMainactivity, you can overrideonBackPressed()inMainactivity and do something else.