Hi I am facing the problem on ICS like dialog
is dismissed
when we click outside dialog
window, due to which I am getting problem like I don't get any confirmation from user.
Please help.
Simply, alertDialog. setCancelable(false); prevent user from click outside of Dialog Box.
AlertDialog dialog = (AlertDialog) getDialog(); dialog. getButton(AlertDialog. BUTTON_POSITIVE). setEnabled(false);
You can use dialog. setCanceledOnTouchOutside(true); which will close the dialog if you touch outside of the dialog.
Check this method from the Android Developers site for dialog.
Try using the
dialog.setCanceledOnTouchOutside (boolean cancel)
Pass a boolean value to enable/disable dialog behaviour when touched outside of the dialog window.
Also go through these links:
How do I fire an event when click occurs outside a dialog
How to cancel an Dialog themed like Activity when touched outside the window?
I hope this answers your question.
You may use
dialog.setCancelable(true/false);
OR
dialog.setCanceledOnTouchOutside(true/false);
For the latest vesrions of Android;
It will disable outSideTouching event.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With