I have an android activity problem.
Here is how my process works:
Login Activity
starts- Login successful.
MainMenuActivity
starts and LoginActivity is finished by me. - 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 backMainMenuActivity
. so I cant killMainMenu
. - User touched on log out and
SettingsActivity
is finished by me and Login activity starts. As user returns the login I need to killMainMenuActivity
but I cant.:/ - I tried
FLAG_ACTIVITY_SINGLE_TOP
,CLEAR_TOP
,SINGLE_TASK
,NEW_TASK
,NO_HISTORY
etc.. 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
Login
activity when you start the main menu. Then you can always clear all activities on logout by doing this:This will only work if
Login
activity is still active at the root (beginning) of the task stack.To prevent the user from BACKing into the
Login
activity from theMain
activity, you can overrideonBackPressed()
inMain
activity and do something else.