Skip to content

Null with postValue #3

@georgious070

Description

@georgious070

I have list adapter, where view holder is viewModel.

inner class MovieViewHolder(v: View) : RecyclerView.ViewHolder(v) {
        val item = MutableLiveData<Movie>() 
}

And when i pass value to vuew holder from

 override fun onBindViewHolder(holder: MovieViewHolder, position: Int) {
        holder.item.**postValue**(movies[position])
 }

I am getting error in my @BindingAdapter, that *item.someValue is null.
I tried to use holder.item.value instead of postValue(), but list is wrong populated with data(some data isnt rewrites).

With ObservableField everything work properly. Am i doing something wrong ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions