Skip to content

Instantly share code, notes, and snippets.

@ltpitt
Created May 29, 2017 21:13
Show Gist options
  • Select an option

  • Save ltpitt/6fd371a466a8b04a7350db90b4845a18 to your computer and use it in GitHub Desktop.

Select an option

Save ltpitt/6fd371a466a8b04a7350db90b4845a18 to your computer and use it in GitHub Desktop.
A simple AlertDialog in Android
AlertDialog alertDialog = new AlertDialog.Builder(MainActivity.this).create();
alertDialog.setTitle("Alert");
alertDialog.setMessage("Alert message to be shown");
alertDialog.setButton(AlertDialog.BUTTON_NEUTRAL, "OK",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});
alertDialog.show();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment