exit dialog android studio

Solutions on MaxInterview for exit dialog android studio by the best coders in the world

showing results for - "exit dialog android studio"
Michele
23 Oct 2020
1Best Code 
2
3@Override
4public void onBackPressed() {
5    new AlertDialog.Builder(this)
6           .setMessage("Are you sure you want to exit?")
7           .setCancelable(false)
8           .setPositiveButton("Yes", new DialogInterface.OnClickListener() {
9               public void onClick(DialogInterface dialog, int id) {
10                   ExampleActivity.super.onBackPressed();
11               }
12           })
13           .setNegativeButton("No", null)
14           .show();
15}
Sofia
28 Apr 2016
1if (dialog.isShowing) {
2     dialog.dismiss()
3}
queries leading to this page
close custom dialog androidclose button in dialog androidclose dialog fragment androidhow to terminate dialog in android studioandroid close dialogdialog with close button android studiohow to close all opened alertdialog in android studioclose dialog in androiddismiss dialog android code how to close current dialog activity androiddialog dismiss androidandroid studio dialog box no closeandroid how to close dialogdismiss dialog android examplehow to close update dialog in androidhow to close a dialog in androidandroid dialog closeandroid don 27t close dialog on clickhow to close dialog from inside the dialog in android javadismiss dialog android studio exampleclose application dialog in android studioandroid studio dismiss dialogandroid force dialog closehow to dismiss dialog in androidhow to close the dialog in androidclose dialogue in androiddialog how to close android studiodismiss dialog android studio how to close dialog box in android studioandroid dialog close eventdo you want to exit dialog androidclose a dialog androidclose dialog inandroidhow to close dialog box in androidhow to dismiss a dialog in androidclose dialog from inside dialog android studioexit dialog android studioandroid dialogfragment close buttonhow to close dialog fragment in androidclose app with dialog androidexit dialog in androidandroid studio closing a dialoghow to close a dialog android studioclose current dialog in android studio when mutlipte dialogsandroid studio close alert dialogclose activity from dialog androidrecreate dialog after close androidhow to stop close dialog when click button in androidandroid studio close dialogopen close dialoghow to close the custom dialog in android javaclose dialogfragment androidclose all alertdialog androidclose dialog androidonly close dialog onclick android studiohow to close a dialog box in androidclose current dialog in android studiohandle dialog close androidhow to close alert dialog in androidhow to close dialog after option is selected androidclose dialog box android studiohow to close dialog box when button is clicked android studiohow to add a close button in dialog androidhow to close current dialog activitydialog show close androidexit dialog android studio