0

I have the following code -

dashboardViewModel.getChatReadersForMessageId(it.messageId).observe(this@ConversationActivity, Observer { readersCount ->
   if (readersCount == groupMembers.size) {
       it.messageWasReadByAllMembers = true
       conversationAdapter.notifyItemChanged(messagesList.indexOf(it))
   }
})

The issue is that messageWasReadByAllMembers effects a single ImageView inside the viewholder, causing an unnecessary re-rendering of the entire VH rather then that single imageview

How do I re-render only specific elements?

Alon Shlider
  • 1,187
  • 1
  • 16
  • 46
  • Prefer using ArrayAdapter with DiffUtil, It will have a default implementation of handling what you need. https://developer.android.com/reference/androidx/recyclerview/widget/DiffUtil – Dharmendra Pratap Singh May 12 '20 at 09:48
  • Add a payload to `notifyItemChanged` and consume it on `onBindViewHolder` like this: https://stackoverflow.com/questions/36956643/partial-update-of-recyclerview-viewholder/36957892#36957892 – Pawel May 12 '20 at 09:52

0 Answers0