Questions related to Android DiffUtil utility class for calculating difference between two lists
Questions tagged [android-diffutils]
180 questions
18
votes
8 answers
ListAdapter not refreshing RecyclerView if I submit the same list with different item order
I am using a RecyclerView with ListAdapter (which uses AsyncListDiffer to calculate and animate changes when list is replaced).
The problem is that if I submit() some list, then re-order that list, and submit() again, nothing happens.
How do I force…

c0dehunter
- 6,412
- 16
- 77
- 139
15
votes
5 answers
DiffUtil ItemCallback areContentsTheSame() always returns true after updating an item on the ListAdapter
While using a ListAdapter I noticed that after updating an item the DiffUtil.ItemCallback areContentsTheSame() method was always returning true. Debugging the code I realized that the old and the new item were exactly the same (the old state…

fmiralles
- 185
- 2
- 7
11
votes
0 answers
How to disable the auto scroll of a RecyclerView (ListAdapter) that happens when an item is updated?
BACKGROUND
I have a UI that shows a list of users' fullnames with a like/dislike button for each item. I am using a ListAdapter that under the hood uses DiffUtil and AsyncListDiffer APIs. The list of users is received as a LiveData from a Room…

Rami Jemli
- 2,550
- 18
- 31
11
votes
4 answers
RecyclerView scroll to top with AsyncListDiffer not working
I am using RecyclerView with AsyncListDiffer (calculates and animates differences between old and new items, all on background thread).
I have a button to sort the list. After I sort it and re-set it to RecyclerView using mDiffer.submitList(items);…

c0dehunter
- 6,412
- 16
- 77
- 139
9
votes
2 answers
why use areItemsTheSame with areContentsTheSame at diffutil recyclerview?
why need to use areItemsTheSame with areContentsTheSame at diffutil recyclerview?
i don't understand i think areItemsTheSame is enough to compare data?
is possible more explain to me?
thank you

Mehrzad
- 93
- 1
- 6
8
votes
1 answer
ListAdapter submitList not updating
I have this issue with the pagination infinite scroll in RecyclerView, I am adding all new item using .addAll()
movieList.addAll(it.movieList)
adapter.submitList(movieList)
Log.wtf("WTF", movieList.size.toString())
The size keeps increasing…

Bitwise DEVS
- 2,858
- 4
- 24
- 67
8
votes
4 answers
How to update list in RecyclerView with DiffUtils?
How do you use DiffCallback to load a newList in RecyclerView when DiffUtil ItemCallback is being used.
I would like to give the user the option to return different size lists from the database when the user selects a different size I want the…

Shawn
- 1,222
- 1
- 18
- 41
8
votes
0 answers
DiffUtil.Callback not working as expected
I am using DiffUtil.ItemCallback along with ListAdapter to update RecyclerView.
It's working pretty well but there is something that bothering me with it's behaviour.
According to the documentation, the areContentsTheSame method should be called…

Moti Bartov
- 3,454
- 33
- 42
7
votes
2 answers
AsyncListDiffer is not updating the recyclerview
I have a RecyclerView with an adapter that uses AssyncListDiffer. The problem I have is that the recyclerview is not updated when changes happen in the LiveData. The observer is notified but the list doesn't update.
This is my adapter:
class…

CyberUser
- 348
- 1
- 4
- 13
7
votes
4 answers
What's wrong with my DiffUtil implementation?
Update: One of the problems is solved: Now updateList is resolved, the problem was that I defined mAdapter as RecyclerView.Adapter instead of MyAdapter. But now even though I am getting data, nothing shows up on the list, it's…

pileup
- 1
- 2
- 18
- 45
6
votes
0 answers
DiffUtil areContentsTheSame() always returns true, after the contents are updated of the List in RecycleViewAdapter
This is my RecyclerView Adapter Class. Clicking an item from the list UI should change of the particular item like background black to white. After clicking an item I am changing the status of the item 0 to 1 from the UI class, based on that status…

Anil Adhikary
- 61
- 3
6
votes
1 answer
Coroutines, async DiffUtil and Inconsistency detected error
I'm having trouble putting up together Kotlin Flows and async DiffUtil.
I have this function in my RecyclerView.Adapter that computes on a computation thread a DiffUtil and dispatch updates to the RecyclerView on the Main thread :
suspend fun…

Charly Lafon
- 562
- 1
- 3
- 18
6
votes
2 answers
Using Recyclerview with DiffUtil.ItemCallback doesn't scroll to top?
I do search of items and every time I fetch from server
When I search "o" it works and then "ot" it works again and as a result of "o" search I have let's say 20 items and in case "ot" I have 10 items
which are part of that 20 items and I do remove…

I.S
- 1,904
- 2
- 25
- 48
6
votes
2 answers
How to fix incorrect position I get when dispatching an update to ListUpdateCallback using DiffUtil
I have an Android application where the user can modify multiple String items using EditText at the same time, so I need to figure out what have changed in order to notify the server about the changes (create new item, update existing item or delete…

O-BL
- 326
- 3
- 12
5
votes
2 answers
List Adapter Diff Util not updating the List Item in Recyclerview
List Adapter diffutil not updating the list item in recyclerview.
It works when I add or remove a item from the list. But not updating the any particular value like isSelected : Boolean = false in object class
How to update the recyclerview view…

Suman Radhakrishnan
- 438
- 8
- 16