I have a recyclerview using listAdaper.this recyclerview has so many Items(this is chat list).
if i edit a particular item of list , DiffUtil compare all of the items of the newlist and old list. it takes long time so updating the list has delay;
is there any way to restrict the Diffutil to compare just particular item?
Asked
Active
Viewed 947 times
2

Vadim Kotov
- 8,084
- 8
- 48
- 62

fatemehalizadeh
- 21
- 1
-
check this answer https://stackoverflow.com/a/60328625/9474700 – behrad Feb 27 '21 at 13:25
-
If you know what that item is, you can trigger the refresh on the list directly. DiffUtil is intended for other purposes. – Sergey M Feb 27 '21 at 13:39
-
@behrad thanx for response.the answer means diffUtil shouldnt use for my purpose? – fatemehalizadeh Feb 27 '21 at 14:19
-
`DiffUtil` will just update the visible changed item (calling necessary "onBindViewHolder()") and with animations. – Sam Chen Feb 27 '21 at 15:34
-
@fatemehalizadeh exactly. you can update your chat item as soon as a new message received. no need for whole update. – behrad Feb 27 '21 at 19:57