0

I am preparing a login dialog that can change to a register dialog.

It has a custom view and contains a clickable text view that I use to switch between the register display and login display.

When a user clicks it I change the title of the dialog and I display or vanish the input box for retyping the password.

However, I can't change the text or the OnClick function of the positive button.

the setPositiveButton method only exists for DialogBuilder but not for the dialog itself.

Do I have to rebuild the entire dialog or is there a way to change the button "on the fly"?

Tom Klino
  • 2,358
  • 5
  • 35
  • 60
  • This answer has some sample code to add to answer below - http://stackoverflow.com/q/2620444/1256219 – brandall Oct 01 '14 at 12:29

1 Answers1

2

After you have created your dialog, you can access the buttons with help of this:

dialog.getButton(AlertDialog.BUTTON1) //BUTTON1 is positive button

With this you can modify the text of the button.

R4ng3LII
  • 457
  • 3
  • 8