Android: AlertDialog - User clicks elsewhere

I have Alert-dialogwith two buttons (Yes / No) If the user clicks the yesor button no, the warning dialog behaves normally and falls into the click method, but if the user clicks or touches somewhere outside the warning dialog, it just disappears, and nothing will happen, is there a way to prevent the dialog from disappearing when the user clicked somewhere else.

+4
source share
6 answers

Disable the Disable Close dialog box when using an external contact use

 dialog.setCanceledOnTouchOutside(false);
+5
source

AlertDialog..

alertDialog.setCanceledOnTouchOutside(false);

+2

.

alertDialog.setCanceledOnTouchOutside(false);

AlertDialog.

+2

YourAlertDialog.setCanceledOnTouchOutside(false);
0

alertDialog.setCanceledOnTouchOutside(false);

,

 alertDialog.setCancelable(false). 

, .

0

:

alertDialog.setCancelable(false); 
alertDialog.setCanceledOnTouchOutside(false);
0

Source: https://habr.com/ru/post/1533281/


All Articles