(Android) Simple confirm dialog

By | October 20, 2014
	
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();
	}

One thought on “(Android) Simple confirm dialog

  1. Pingback: Android confirm dialog box with OK and Cancel button • Catzie.net Blog

Leave a Reply

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