When using databinding in my app, I get the following warning when compiling:
Warning:Method references using \'.\' is deprecated. Instead of \'handler.onItemClick
You can still use JavaVersion.VERSION_1_8
.
Just use app:onClick
, and define a BindingAdapter like this:
@BindingAdapter("onClick")
public static void bindOnClick(View view, final Runnable runnable) {
view.setOnClickListener(v -> runnable.run());
}
Then you can use app:onClick="@{handler::onItemClick}"
without warnings or errors.