Loading

Wednesday, May 18, 2011

Create Alert Dialog with OK and Cancel options

Alert Dialog with OK and Cancel options

AlertDialog.Builder myAlertDialog = new AlertDialog.Builder(AndroidAlertDialog.this);
myAlertDialog.setTitle("--- Title ---");
myAlertDialog.setMessage("Alert Dialog Message");
myAlertDialog.setPositiveButton("OK", new DialogInterface.OnClickListener() {

public void onClick(DialogInterface arg0, int arg1) {
// do something when the OK button is clicked
}});
myAlertDialog.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {

public void onClick(DialogInterface arg0, int arg1) {
// do something when the Cancel button is clicked
}});
myAlertDialog.show();




SHARE TWEET

Thank you for reading this article Create Alert Dialog with OK and Cancel options With URL http://x-tutorials.blogspot.com/2011/05/create-alert-dialog-with-ok-and-cancel.html. Also a time to read the other articles.

0 comments:

Write your comment for this article Create Alert Dialog with OK and Cancel options above!