I am using data binding library for binding data in recyclerview but I keep getting the below error, I don't understand where is the mistake, I have checked my code several times and also I have tried all the possible solutions from the internet but nothing is working. Kindly help me to resolve this issue. Thank you in advance.
Error
Could not find accessor com.apis.models.MoviesPageModel.movies
at android.databinding.tool.util.L.printMessage(L.java:134)
at android.databinding.tool.util.L.e(L.java:107)
viewmodel
class MoviesPageModel(private val api: ServiceApi): BaseViewModel() {
private val _moviesList: MutableLiveData<List<Section>> = NotNullMutableLiveData(arrayListOf())
val movies: MutableLiveData<List<Section>> get() = _moviesList
fun getMovies() {
addToDisposable(api.getMoviesRE().with()
.doOnSubscribe {}
.doOnSuccess {}
.doOnError {}.subscribe({
if(it != null){
_moviesList.value = it.Sections
}
}, {
})
)
}
}
xml
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<data>
<variable
name="vm" type="com.models.MoviesPageModel" />
</data>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui_fragments.Movies">
<androidx.recyclerview.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:moviesAdapter="@{vm.movies}"
app:viewModel="@{vm}" />
</RelativeLayout>
