I have a separate layout that I want to call onClick
and update a field on callback
<include
android:onClick="@{() -> viewModel.changeItem(2)}"
layout="@layout/item"
app:attr="@{viewModel.title}"
app:desc="@{viewModel.description}"
app:active="@{viewModel.isSelected}"
/>
But it returns the following binding error:
Cannot find the setter for attribute 'android:onClick' with parameter type lambda on com.X.databinding.ItemBinding.
But I can binding on other views
<TextView
android:onClick="@{() -> viewModel.changeItem(1)}"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>