I have a dialog with: Title, Message and 2 Buttons (Neutral and Negative) i tried to put another Neutral or Negavite button but it shows only one button of each(Neutral and Negative), so is there a way to put a button or do I have to create a custom layout of the dialog? If so, how to do it?
code:
AlertDialog.Builder dialogo = new AlertDialog.Builder(this);
dialogo.setMessage(msg);
dialogo.setTitle(titulo);
dialogo.setNeutralButton("OK", null);
dialogo.setNegativeButton("Delete", deletar);
dialogo.show();
You can add a third button using setPositiveButton
but aside from that, you'll have to set a custom view. To set a custom view you just call setView(yourView)
with the AlertDialog.Builder
.
You can have upto three buttons by default, namely Neutral, Negative and Positive. Beyond that, you will either need to use a custom layout in the dialog, or create your own dialog.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With