https://kotlinlang.org logo
#android
Title
# android
a

alle.iacob

01/06/2019, 11:43 PM
do someone have any idea what I did wrong?
n

nikolay

01/07/2019, 9:24 AM
Both ways looks ok, I have a couple of suggestions that you could try: 1. try to write as normal function
Copy code
@BindingAdapter("errorText")
fun setErrorText(view: TextInputLayout, errorText: String?) {
   view.error = errorText
}
2. try to specify setter parameter type:
Copy code
@set:BindingAdapter("errorText")
var TextInputLayout.errorText: String?
   get() = error.toString()
   set(value: String?) {
       error = value
   }
a

alle.iacob

01/07/2019, 5:15 PM
I've solve it
in the xml I was trying to set it as app:errorText or android:errorText
but it was enough errorText
n

nikolay

01/07/2019, 5:22 PM
wait, don’t get, but it should work with
app
as well
a

alle.iacob

01/07/2019, 5:22 PM
I've tried both your examples
you can see code that I've copied to the chat
but it didn't worked
n

nikolay

01/07/2019, 5:25 PM
could you, please, show the layout where you are using it? just curious.
a

alle.iacob

01/07/2019, 5:27 PM
full file?
bottom_fragment.xml
on pin_edit_text_layout
but temporarily I've removed it
and the view model is an AndroidViewModel