prevent dialog from closing

To prevent dialog box from getting dismissed on back key pressed use this

dialog.setCancelable(false);

And to prevent dialog box from getting dismissed on outside touch use this

dialog.setCanceledOnTouchOutside(false);
原文地址:https://www.cnblogs.com/shawnwxm/p/9479844.html