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.
Use setCancelable(false)
setCancelable(false)
SampleDialog sampleDialog = SampleDialog.newInstance(); sampleDialog.setCancelable(false); sampleDialog.show(getSupportFragmentManager(), SampleDialog.class.getSimpleName());