Last active
August 29, 2015 14:06
-
-
Save ted80/60b77ed535f65911ef68 to your computer and use it in GitHub Desktop.
back button
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public void onBackPressed() | |
{ | |
new AlertDialog.Builder(this) | |
.setIcon(android.R.drawable.ic_dialog_alert) | |
.setTitle("Exit") | |
.setMessage("Are you sure you want to quit?") | |
.setPositiveButton("Yes", new DialogInterface.OnClickListener() | |
{ | |
@Override | |
public void onClick(DialogInterface dialog, int which) | |
{ | |
finish(); | |
} | |
}) | |
.setNegativeButton("No", null) | |
.show(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment