I am trying to prevent an AlertDialog box from closing when pressing the back button in Android. I have followed both of the popular methods in this thread, and with System.out.
AlertDialog.Builder builder = AlertDialog.Builder(this) Dialog dialog = builder.create() dialog.setCancelable(false) dialog.setCanceledOnTouchOutside(false)
This will prevent the user on canceling the dialog when they press the back button or touch outside the dialog window