@BindingAdapter("app:errorText") fun setErrorT...
# android
a
@BindingAdapter("app:errorText") fun setErrorText(view: TextInputLayout, errorText: String?) { view.error = errorText }
s
Databinding seems a bit tricky to do with Kotlin. Is there a reason you are making the
errorText
nullable? Your code seems fine and should work. You can try making it a non nullable type and try again. If that does not work, try casting the
viewmodel.error
to a String in the layout
Copy code
<com.google.android.material.textfield.TextInputLayout
                       android:id="@+id/pin_edit_text_layout"
                       android:layout_width="match_parent"
                       android:layout_height="wrap_content"
                       app:errorEnabled="true"
 app:errorTextAppearance="@style/ThemeOverlay.MaterialComponents.TextInputEditText.OutlinedBox"
                       app:errorText="@{(String) viewModel.error}>
@alle.iacob
n
what is the type for
viewModel.error
? is it
LiveData<String>
?
a
ObservableField<String>