update RecyclerView with Android LiveData

前端 未结 4 1001
感动是毒
感动是毒 2021-01-31 16:13

There are many examples how to push new list to adapter on LiveData change.

I\'m trying to update one row (e.g number of comments for post) in the huge list. It would be

4条回答
  •  深忆病人
    2021-01-31 16:47

    Using DiffUtil might help with updating one row in a huge list. You can then have LiveData wrap the list of comments instead of a single comment or attribute of a comment.

    Here's an example of using DiffUtil within a RecyclerView adapter and the list LiveData observation code in the fragment.

提交回复
热议问题