Skip to content

Instantly share code, notes, and snippets.

@NLKNguyen
Created November 1, 2014 19:13
Show Gist options
  • Select an option

  • Save NLKNguyen/3ce6c74758efc172dce4 to your computer and use it in GitHub Desktop.

Select an option

Save NLKNguyen/3ce6c74758efc172dce4 to your computer and use it in GitHub Desktop.
Android/Java snippet
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage("Are you sure?");
builder.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
dialogInterface.dismiss();
// Do something
// ...
// ...
}
});
builder.setNegativeButton("No", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
dialogInterface.dismiss();
}
});
builder.create().show();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment