In the development of a problem, is a touch of the edge of the dialog box outside the dialog box will automatically disappear. This question is very tangled ah, looked for the discovery from Android 4.0, Alertdialog has changed, that is, touch the edge of the dialog box outside the dialog box will automatically disappear, check the source code, find a solution:
When studying the parent class, it is found that you can set such a property after AlertDialog.Builder.create () to call both methods
Method One:
Setcanceledontouchoutside (false); When this method is called, it does not work in places other than the dialog box. Pressing the back key also works
Method Two:
Setcancelable (false); When this method is called, it does not work in places other than the dialog box. Pressing the back key also does not work
These two methods belong to the dialog method, can consult the source code
The revised source code is as follows:
Case 1: DismissDialog (1); NewBuilder (splashactivity. This). Settitle ("Tips"). Setcancelable (false). Setmessage ("failed to get software initialization information! \ n Please check that the network is unobstructed. "). Setpositivebutton ("Confirm",NewOnclicklistener () {@Override Public voidOnClick (Dialoginterface Dialog,intwhich) {Dialog.dismiss (); Splashactivity. This. Finish (); }}). Show (); Break;