Skip to content

Instantly share code, notes, and snippets.

@dp-singh
Forked from marcelohd/AlertDialog.Builder Android
Last active August 29, 2015 14:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dp-singh/e53592fa8b8e4739a97a to your computer and use it in GitHub Desktop.
Save dp-singh/e53592fa8b8e4739a97a to your computer and use it in GitHub Desktop.
AlertDialog.Builder builder = new AlertDialog.Builder(Activity.this);
builder.setTitle("Delete")
.setIcon(android.R.drawable.ic_dialog_alert)
.setMessage("Do you want to delete?")
.setCancelable(false)
.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
DAO dao = new DAO(Activity.this);
dao.deleteValues(valueSelected);
dao.close();
}
})
.setNegativeButton("No", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
});
builder.show();
return false;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment