I made AlertDialog using a builder for the activity, but I want to put a button in it Okay, or whatever, you do something when the button is pressed Not the yes or no button by default. How can we do that?
android button builder alertdialog
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage("Look at this dialog!")
.setCancelable(false)
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
//Button Click Action
}
});
AlertDialog alert = builder.create();
alert.show();
You can do it like this.
© 2024 OneMinuteCode. All rights reserved.