Why DataBinding does not find BindingConversion?

Good afternoon. Please tell me, why the binding cannot find bindingConvertion?
In the markup in the text attribute put the value of a field of type int:
<TextView
android:id="@+id/user_age"
android:layout_width="wrap content"
android:layout_height="wrap content"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
 android:text='@{TextUtils.isEmpty(String.valueOf(user.age)) ? "No age" : user.age}'
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
 app:layout_constraintTop_toBottomOf="@+id/user_name" />


Next, in a separate class prescribed convertŠµr:
public class BindingConverters {
@BindingConversion
 public static String intToString(int age){
 return String.valueOf(age);
}
}

Get an exception:
java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.CharSequence


Why?
March 19th 20 at 08:40
0 answer

Find more questions by tags Android