I am facing issue with showing AlertDialog when I switch from one activity to another through navigation(Back button).
scenario is like this:
1. My application is running on and I am on second Page of application.
2. I press back button but at same time for second page one scenario is execute & AlertDialog is open on screen.
3. I already press back button I redirect to main screen & AlertDialog dismiss with out any user input.
Already used this ,but it should not work for me.
1. Intent.FLAG_ACTIVITY_NEW_TASK
2. onRetainNonconfigurationInstance() & getLastNonConfigurationInstance()
I want to show same AlertDialog on Home Page (MainActivity),if I navigate through it.
I want to do this for all my pages to home one.
Anybody having any kind of idea & suggestion.
Thanks,
If you want to get user interaction before user leave 2nd Activity then You have to put AlertDialog in
onStop()oronDestroy()of 2nd Activity or If you want to show AlertDialog after your 2nd Activity is closed and You are in Main Activity then you have to put AlertDialog inonActivityResult()of Main Activity. (But for this you have to start 2nd Activity from MAin Activity usingstartActivityForResult())