Skip to content

Instantly share code, notes, and snippets.

@yahyaahrika
Last active June 23, 2016 15:36
Show Gist options
  • Save yahyaahrika/877985f85ce9b0e5b324d9645e268af4 to your computer and use it in GitHub Desktop.
Save yahyaahrika/877985f85ce9b0e5b324d9645e268af4 to your computer and use it in GitHub Desktop.
Alert Message
DialogInterface.OnClickListener dialogClickListener =
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int button) {
if (button == DialogInterface.BUTTON_POSITIVE) {
//Insert Data management code here
Toast.makeText(MainActivity.this,
getString(R.string.all_deleted),
Toast.LENGTH_SHORT).show();
}
}
};
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage(getString(R.string.are_you_sure))
.setPositiveButton(getString(android.R.string.yes), dialogClickListener)
.setNegativeButton(getString(android.R.string.no), dialogClickListener)
.show();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment