Create Alert Dialog in Android

Alert Dialog is used for Show information to user .Its also used for give user action output that what are performed . Following are the example of Simple Dialog.
private void SimpleAlertDialog() {
Builder builder = new AlertDialog.Builder(this);
builder.setTitle("My Alert Dialog");
builder.setMessage("This is example of Simple Alert Dialog");
builder.setPositiveButton("OK ", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});
AlertDialog alert = builder.create();
alert.show();
}

Post a Comment

0 Comments