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

alle.iacob

01/06/2019, 11:43 PM
@BindingAdapter("errorText") fun TextInputLayout.setErrorText(errorText: String?) { error = errorText }
g

gildor

01/09/2019, 9:50 AM
Why so you need this binding adapter? You can just set error directly: app:error="${model.yourErrorString}"
a

alle.iacob

01/09/2019, 11:19 AM
com.google.android.material.textfield.TextInputLayout does not have an app:error argument to be used into the xml file
r

radityagumay

01/09/2019, 3:08 PM
@alle.iacob just don't use Android Binding.
g

gildor

01/10/2019, 8:15 AM
Raditya, it's just not helpful comment, it's not a discussion about should or not you use bindings
@alle.iacob it's not required to have app:error attribute, data binding allow you to call any method of this view, so if you have method error or setError, this will just work. So for such simple cases as just passing value to existing setter is just works without explicit adapters
a

alle.iacob

01/10/2019, 8:57 AM
ok, will try
thanks
11 Views