Android4.0 and above AlertDialog is outside the edge of the touch dialog, and the dialog disappears
You can set such a property, of course, you must call these two methods after AlertDialog.Builder.create().
method one:
setCanceledOnTouchOutside(false); When calling this method, pressing outside the dialog does not work. Pressing the return key also works
Method Two:
setCancelable(false); When calling this method, pressing outside the dialog has no effect. Pressing the return key doesn't work either