I feel like a newbi but cant find any answer :slig...
# android-databinding
p
I feel like a newbi but cant find any answer 🙂 I’m having issues with my own data binding adapter. I have this adapter code: @BindingAdapter(“value”) fun setValue(view: TextView, value: Float?) { view.text = value.toString() } and this in the XML: <TextView android:id=“@+id/result” android:value=“@{viewModel.value}” android:textSize=“128sp”/> viewModel.value is a LiveData<Float>() And I’m getting this message: Found data binding errors. ****/ data binding error ****msg:Cannot find the setter for attribute ‘android:value’ with parameter type android.arch.lifecycle.MutableLiveData<java.lang.Float> on android.widget.TextView. ****\ data binding error ** What I am missing?
g
in the annotation you said only
@BindingAdapter("value")
you should use
app:value="@{viewModel.value}
in the xml then. If you want to use "android:value" add the android prefix to the annotation like
@BindingAdapter("android:value")
👍 1
Can you set lifecycleOwner on your binding?
👍