Reputation: 29
I am using several languages in the app, so I need to switch the texts on the date picker buttons. I'm writing a simple code that looks like this:
val datePickerDialog = builder.build()
datePickerDialog.setButton(DialogInterface.BUTTON_NEGATIVE, R.string.common_dialog_cancel)
datePickerDialog
I'm returning the dialog on the last line. The problem is that the second line identifies the errors I cannot resolve. "None of the following functions can be called with the arguments supplied." As far as I know, alertDialog should have a method setButton() that takes a button and a string as arguments, but something is not right in my code. Any suggestions?
Upvotes: 0
Views: 180
Reputation: 11
According to the docs there is no function that supports these 2 arguments. I guess you should use this one:
public void setButton (int whichButton,
CharSequence text,
DialogInterface.OnClickListener listener)
So you have to add a 3rd argument with the click listener.
Upvotes: 1