Created
April 19, 2013 03:17
-
-
Save tediscript/5417875 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| private void doExit() { | |
| AlertDialog.Builder ab = new AlertDialog.Builder(MainActivity.this); | |
| ab.setMessage("Are you sure you want to exit?") | |
| .setPositiveButton("Yes", dialogClickListener) | |
| .setNegativeButton("No", dialogClickListener).show(); | |
| } | |
| private DialogInterface.OnClickListener dialogClickListener = new DialogInterface.OnClickListener() { | |
| @Override | |
| public void onClick(DialogInterface dialog, int which) { | |
| switch (which) { | |
| case DialogInterface.BUTTON_POSITIVE: | |
| android.os.Process.killProcess(android.os.Process.myPid()); | |
| break; | |
| case DialogInterface.BUTTON_NEGATIVE: | |
| // Do Nothing | |
| break; | |
| } | |
| } | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment