Skip to content

Instantly share code, notes, and snippets.

@louisbl
Created October 16, 2014 08:18
Show Gist options
  • Save louisbl/11e2d56d8e4754290e51 to your computer and use it in GitHub Desktop.
Save louisbl/11e2d56d8e4754290e51 to your computer and use it in GitHub Desktop.
Android Alert Dialog
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
builder.setNegativeButton("CANCEL", null);
TextView view = new TextView(this);
view.setText("A dialog");
view.setPadding(20, 20, 20, 20);
view.setGravity(Gravity.FILL_HORIZONTAL);
view.setTextSize(18);
builder.setView(view);
builder.setTitle("Dialog title");
builder.create().show();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment