Questions related to Android DiffUtil utility class for calculating difference between two lists
Questions tagged [android-diffutils]
180 questions
2
votes
0 answers
RecyclerView DiffUtil.dispatchUpdateTo Completed Notification
I'm currently using the DiffUtil class to calculate and dispatch updates to my adapter using a ListUpdateCallback as follows:
inner class NotificationCallback(private val onInsert: () -> Unit) : ListUpdateCallback {
override fun…

Zurvæ
- 610
- 1
- 8
- 23
2
votes
1 answer
Android Room - how to get the new data only?
What is a result of this Dao method after inserting some messages in the database:
@Query("SELECT * FROM messages")
Flowable
- > getMessages();
1 - ALL messages stored in the database will be emitted after this change
or
2 - Only the…

isabsent
- 3,683
- 3
- 25
- 46
2
votes
1 answer
Does hasStableIds and getItemId have any significance if DiffUtil is used?
We are using DiffUtil.CalculateDiff with a custom DiffUtil.Callback to handle changes to the underlying data.
The identity of our elements is rather complex, and that's why we are using custom equality check in areContentsTheSame and…

Kornelije Petak
- 9,412
- 15
- 68
- 96
1
vote
1 answer
DiffUtil (dispatchUpdatesTo) not updating Recycler View
I am implementing a recycler view with diff util, but the first time I send the list to the adapter, the recycler view is not notified about the new list. Only the second time I update the list does the recycler receive the notification. I tried…

Thelgon
- 15
- 3
1
vote
0 answers
how do i update items that change in recyclerview use diffutil?
DiffUtil do not update items recyclerview with the same id and not same the content,
The model has [id : Int and title : String]. I want to the diffUtilCallBack check items with the same id and not same title and update to recyclerview
Please help…

Tuấn Nguyễn
- 19
- 2
1
vote
2 answers
Remove AsyncListDiffer list and update it after click close search (submit null not working)
In this app I am using AsyncListDiffer I have a toolbar with searchBar and a search icon I am trying to remove the old search list when the user clicks on close search and make a new call request then submits the new one, it seems the…

Dr Mido
- 2,414
- 4
- 32
- 72
1
vote
1 answer
How to insert different item e.g. native ads on each 10 items of recyclerView using diffutil "AsyncListDiffer"
Since I decided to migrate from setting items and notifyDataSetChanged() to using AsyncListDiffer SubmitList method I am facing problems with implementing native ads to RecyclerView in my current adapter class
I used this method in the old question…

Dr Mido
- 2,414
- 4
- 32
- 72
1
vote
1 answer
Android. Pagging3 not receive error state
I'm using paging3. My RemoteMediator returns Result.Error from catch:
catch (e: Exception) {
return MediatorResult.Error(handler.getError(e))
}
Inside fragment I'm listening for state changes:
adapter.addLoadStateListener {…

testivanivan
- 967
- 13
- 36
1
vote
2 answers
Android. How to detect when ui was updated after submit list in recycler view?
I have implemented search contacts applications. Contact list may be very large. For implementation I used kotlin flow, RecyclerView and AsyncListDiffer. Initially, I used diff util, but after that I noticed that on some devices, lags began when…

testivanivan
- 967
- 13
- 36
1
vote
0 answers
RecyclerView ListAdapter with Header View
It seems ListAdapter with AsyncDifferConfig and DiffUtil does not work properly when a RecyclerView has header itemview implemetation, the list always start to display items at bottom upon calling submitList(). Is there a way to use ListAdapter with…

Bitwise DEVS
- 2,858
- 4
- 24
- 67
1
vote
1 answer
How to handle changed items with ListAdapter and DiffUtil?
I am facing an issue where a change in an item is not reflected when using submitList in ListAdapter.
I know that below code works in case I want to remove an item when using ListAdapter as inside submitList the framework checks whether lists are…

nayan dhabarde
- 1,734
- 1
- 19
- 38
1
vote
1 answer
RecyclerView does not update the screen
I'm working on adding an item via a button.
I used ListAdapter and DiffUtil.
However, when the button is pressed, the first item is updated, but the screen does not update after that.
I tried debugging with Adapter and DiffUtil.
I checked whether…

ybybyb
- 1,385
- 1
- 12
- 33
1
vote
0 answers
RecyclerView doesnt keep its scroll position when I submitting same list with different order
I'm using ListAdapter to show my device music on the screen.
From option menu user can change the tracks order.
When user changes the track order the recycler view shows updated list but also changes its scroll position.
Can you help me to avoid…

Petros Mosoyan
- 238
- 2
- 15
1
vote
2 answers
DiffUtil Not working with ListAdpater when view is updating Android Kotlin
Hey I have Reyclerview with DiffUtill using ListAdapter. I added element through submitList function. But when updating the list view is not redrawing the element. Until I used notifyDataSetChanged() or setting adapter again. So what the use case of…

Kotlin Learner
- 3,995
- 6
- 47
- 127
1
vote
1 answer
Using "ListAdapter" areItemsTheSame on items without unique identifier
To properly implement a DiffUtil.ItemCallback passed inside the constructor of ListAdapter, both areItemsTheSame and areContentsTheSame must be implemented.
Now for areItemsTheSame it is advised that a unique identifier of type of . So for my…

Stylianos Gakis
- 862
- 8
- 19