Skip to content

Instantly share code, notes, and snippets.

@tediscript
Created April 19, 2013 03:17
Show Gist options
  • Select an option

  • Save tediscript/5417875 to your computer and use it in GitHub Desktop.

Select an option

Save tediscript/5417875 to your computer and use it in GitHub Desktop.
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