When studying its parent class, it was found that you can set such a property so that these two methods can be called after ()
Method 1:
setCanceledOnTouchOutside(false); When this method is called, pressing places outside the dialog box does not work. Pressing the return key also works
Method 2:
setCanceleable(false); When calling this method, pressing places outside the dialog box does not work. Pressing the return key does not work
Both methods belong to Dialog methods, you can check the source code
Modified source codeas follows:
Copy the codeThe code is as follows:
case 1:
dismissDialog(1);
new Builder().setTitle("tip").setCancelable(false)
.setMessage("Failed to obtain software initialization information!\nPlease check whether the network is smooth.")
.setPositiveButton("Confirm", new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
();
();
}
}).show();
break;