Dialog Is Not Closed Dialog.dismiss() When Navigating Backand Forth To Settings Screen
What is happening:: dialog is popped I click ok - > it leads me to settings screen Now i press back button When i come back dialog button is still there again i click ok again
Solution 1:
dialog is used inonstart()
please use in oncreate()
,
when your back to your actvity it's called the onstart()
and onresume()
,
please read the activity lifecycle
lifecycle
@OverrideprotectedvoidonStart() {
super.onStart();
if(!start_dialog)
{
start_dialog = true;
open(getResources().getString(R.string.location_not_enabled));
}
}
Solution 2:
In the ok button code instead of
dialog.dismiss();
use it
alert.dismiss();
Post a Comment for "Dialog Is Not Closed Dialog.dismiss() When Navigating Backand Forth To Settings Screen"