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'd suggest to start the settings activity for result (see here), and when the user requests to logout, set a result accordingly. You will get this result in MainActivity's onActivityResult (see here) and can handle the logout there, finishing the mainActivity before starting the loginActivity.