I really want to make an AlertDialog with single button, can someone guide me with this. Thanks!
2 Answers
Yes you can:
new AlertDialog.Builder(this)
.setIcon(R.drawable.icon)
.setTitle("Error")
.setMessage("Please fill out the entire form")
.setPositiveButton("Close", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
})
.create()
.show()
;
Comments
Use AlertDialog.Builder.
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
public onClick(DialogInterface dialog, int which) {
// do something interesting.
}
});
// other code to customize the dialog
Dialog d = builder.create();
AlertDialogis possibly from Android, is that what you are working on?