(Android) Simple confirm dialog


[java]
private void confirmDialog() {
AlertDialog.Builder builder = new AlertDialog.Builder(context);

builder
.setMessage("Are you sure?")
.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
// Yes-code
}
})
.setNegativeButton("No", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog,int id) {
dialog.cancel();
}
})
.show();
}
[/java]

One response

  1. […] above code was adapted from (Android) Simple confirm dialog at Jymden.com, and then modified to work on my […]

Leave a Reply

Your email address will not be published. Required fields are marked *