Skip to content

Instantly share code, notes, and snippets.

@MaximAlien
Created August 19, 2016 13:07
Show Gist options
  • Save MaximAlien/7b14d2e84644e04016778a013814ad21 to your computer and use it in GitHub Desktop.
Save MaximAlien/7b14d2e84644e04016778a013814ad21 to your computer and use it in GitHub Desktop.
[Android] Code which creates AlertDialog on Android
AlertDialog dialog = new AlertDialog.Builder(this).setMessage("Title")
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
}).setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
}).create();
dialog.setCancelable(false);
dialog.show();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment