I have a Car class implemented like this :
public class Car extends RealmObject implements Serializable {
@SerializedName("car_details")
@Expose
private RealmList<CarDetail> carDetails = null;
public RealmList<CarDetail> getCarDetails() {
return carDetails;
}
public void setCarDetails(RealmList<CarDetail> carDetails) {
this.carDetails = carDetails;
}
}
in My trying to access my carDetails from my Layout like this :
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:text="@{car.carDetails.get(0).grade}"
android:textAllCaps="true"
android:textColor="@color/black"
android:textSize="30sp"
android:textStyle="bold" />
but i'm getting an error when compiling , any suggestions how to access the list?
i also tried with :
android:text="@{car.carDetails[0].grade}"
I'm getting an error like this :
error: package me.test.databinding does not exist
It's cannot generate the databinding classes
Seeing you error log screenshot shows the actual problem
FIX:
This can be fixed by either adding RxJava to your project or create an empty dummy file that looks like the following.
Reference:
See this, this and this