Questions related to Android DiffUtil utility class for calculating difference between two lists
Questions tagged [android-diffutils]
180 questions
5
votes
2 answers
How to use DiffUtil with multiple View types
I have implemented a recyclerview with multiple view types , and i want to add DiffUtil . I managed to do so for one type but when i try to support multiple view types i can't
So my question is : does DiffUtil supports multiple view types and is…

AYMEN SOUMER
- 175
- 2
- 8
5
votes
1 answer
updating recycler view adapter with diff utils, isnt working correctly when adding an item
I'm using diff utils to update my recycler view (live data from view model returns a list), I have an item decoration that adds a large amount of padding to the last element in the list but as diff utils updates the recycler view properly by calling…

martinseal1987
- 1,862
- 8
- 44
- 77
4
votes
1 answer
Jetpack Compose Lazy Column insertion and deletion animations with multiple item types
What's the best way to animate insertion and deletion animations in lazy column or row with multiple item types similar to how it's done using DiffUtil?

Charles Woodson
- 682
- 1
- 8
- 22
4
votes
2 answers
DiffUtil is changing my position when list is sortedByDescending
I am using diff util to improve performance in my recyclerview as opposed to calling notifyDataSetChanged(). The recyclerview has a header with some chips which can reorder the list by aplhabetical order, highester score etc
When I click the chip in…

AndroidDev123
- 280
- 3
- 24
4
votes
1 answer
Unwanted animation due to conflict between ItemTouchHelper and DiffUtil
I am implementing a RecyclerView with drag and drop support. When an item is dropped, the index column of that item will be updated in the Room database to store the updated sorting.
The problem I am facing is, when I call the Room database update…

PhantomCosmos
- 119
- 1
- 7
4
votes
1 answer
Android - ViewPager2 resets adapter position to 0 on calling Diffutil.dispatchUpdatesTo
I have a ViewPager2 which is set to swipe horizontally. I idea is to build an infinite scrolling pager. The class looks something like this:
class SwipeAdapter(fragmentActivity: FragmentActivity): FragmentStateAdapter(fragmentActivity)
I have…

Udayaditya Barua
- 1,151
- 12
- 26
4
votes
1 answer
RecyclerView not refreshed automatically with submitList() and LiveData
here is the situation:
I have a RecyclerView in a Fragment using DataBinding. Its adapter is a ListAdapter.
class MyFragment : Fragment() {
override fun onCreateView(...) {
val binding = // inflate layout with DataBindingUtil
…

neige-i
- 81
- 1
- 9
4
votes
0 answers
RecyclerView / DiffUtils animation when dataset change without full refresh
I would like two things :
To not reload / refresh the adapter when i delete an item inside RecyclerView (no use of notifyDatasetChanged).
To do so i am using DiffUtils which works perfectly fine. But i also would like to keep the…

Tom3652
- 2,540
- 3
- 19
- 45
4
votes
1 answer
notifyItemMoved() not working when migrated to ListAdapter Android
We have this feature in our App where we can drag recycler view Items up and down.
Inside onMove() of ItemTouchHelper.Callback() we call
adapter.onItemMove(source.adapterPosition, target.adapterPosition)
and the adapter code goes like this
override…

shalini
- 355
- 4
- 17
4
votes
0 answers
submitList() in recyclerview with diffutil causes recyclerview to blink
I have a recyclerview that's been updated from remote source ,so it is working pretty well , the only annoying thing is that when the screen is pulled for a refresh and a get request is triggered the recyclerview is updated even though nothing has…

joghm
- 569
- 3
- 20
4
votes
1 answer
DiffUtil is not updating the RecyclerView
I have made an adapter for a recyclerView and used DiffUtil to show the updation of the list in a fancier way. I used google codelabs for a reference for this. But the list is not updating from the following code. Please help
class LaptopAdapter :…

potatoxchip
- 516
- 1
- 7
- 20
3
votes
1 answer
How to use DiffUtils In RecyclerViewAdapter on Android
In my application I want use RecyclerView adapter and for set data I used DiffUtils.
I Want search data from server and then show it into RecyclerView!
I write below codes, but after search data show items overlay!
I want first clear previous data,…

Dr.KeyOk
- 608
- 1
- 6
- 13
3
votes
2 answers
ListAdapter DiffUtils newItem and oldItem the same when submitList() called
Just FYI, I'm not exactly looking for a 'fix' but for an explanation and a discussion that might help understand a little bit more how seemingly silly things like these work.
I was working on this bigger project when I realized that somewhere, a…

Miguel Lasa
- 470
- 1
- 7
- 19
3
votes
1 answer
DiffUtil clashes with ArrayIndexOutOfBoundsException when updating the recyclerview adapter list
I'm trying to update ViewPager2 adapter with a new list of items using DiffUtil but it keeps clashing now and then.
from the Fragment
private suspend fun updateMap(items: List- ) {
briefAdapter.submitList(items)
…

Edijae Crusar
- 3,473
- 3
- 37
- 74
3
votes
1 answer
Android DiffUtil in item-specific situations
I usually use diffutil with Recyclerview when needed. Right now I have situation where the items I get from backend look like this:
data class CarouselItem(var url: String, var pictureUrl: String, var visible: String)
All 3 fields can be the same…

Kratos
- 681
- 1
- 13
- 30