Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jimmy-collazos/1427945 to your computer and use it in GitHub Desktop.
Save jimmy-collazos/1427945 to your computer and use it in GitHub Desktop.
Snippet/Android: Simple Alert Dialog Popup with Title, Message, Icon and Button
//@See http://www.androidsnippets.com/simple-alert-dialog-popup-with-title-message-icon-and-button
AlertDialog alertDialog = new AlertDialog.Builder(this).create();
alertDialog.setTitle("Title");
alertDialog.setMessage("Message");
alertDialog.setButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
//@ TODO Add your code for the button here.
}
});
// Set the Icon for the Dialog
alertDialog.setIcon(R.drawable.icon);
alertDialog.show();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment