Questions related to Android DiffUtil utility class for calculating difference between two lists
Questions tagged [android-diffutils]
180 questions
2
votes
2 answers
How can I see my List in my RecyclerView.ListAdapter?
So I'm doing a project and I'm looking to see if my RecyclerView works. Here's what I got so far
The data class:
@Parcelize
@Entity(tableName = "asteroid_feed")
data class Asteroid(val id: Long, val codename: String, val closeApproachDate: String,
…

OEThe11
- 341
- 2
- 11
2
votes
1 answer
Update inner view inside RecyclerView item with LiveData, Room and DiffUtil
I have Message table in Room with following structure: id, text, animRes, readStatus.
Then I subscribe to livedata exposed by room to display this item in recyclerview with diffutil adapter.
When new message appeared in RV, animation start playing.…

Umy
- 423
- 4
- 9
2
votes
1 answer
diffutil areContentsTheSame function compares only new items
I am using AsyncListDiffer in my project, in which i have lots of quotes in main page
Below is the code i've written in my recyclerview adapter
private val diffCallback = object : DiffUtil.ItemCallback
() { override fun…

nasibeyyubov
- 1,735
- 3
- 11
- 28
2
votes
0 answers
java.lang.IndexOutOfBoundsException: Inconsistency detected. Invalid item position in androidx.leanback.widget.HorizontalGridView
I am facing this crash in HorizontalGridView (RecyclerView) in leanback component
Device: Android TV
Android Version: 9
Logic:
My Adapter extends ListAdapter to which I will submit the list of data, which will internally handles the notification to…

Benaka
- 21
- 2
2
votes
0 answers
how to update just one item in recyclerview with listAdapter(using diffUtil)
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…

fatemehalizadeh
- 21
- 1
2
votes
1 answer
Which is more efficient DiffUtil or SortedList?
I recently came across the concept of using Diffutil and SortedList.Callback<> to change data in instead of notifyDataSetChanged() directly but now I am confused which one to use at which condition.

Mohit Kumar
- 552
- 9
- 29
2
votes
0 answers
Recycler adapter using diffutil , unable to see newly added item user need to scroll down
Adapter class, with DiffUtil implementation
class MyAdapter(private val context: Context, private val onItemClickListener:
(id:String)->Unit) :ListAdapter(MyDiffCallback()) {
override fun onCreateViewHolder(parent:…

eliot
- 73
- 1
- 7
2
votes
1 answer
When updating RecycleView using DiffUtils ImageViews are flickering
In my RecyclewView's adapter I am using DiffUtils to update only those items which were modified. While doing this I've noticed that ImageViews are flickering on every update and while debugging I found out that onCreateViewHolder method of my…

matip
- 794
- 3
- 7
- 27
2
votes
3 answers
Recyclerview DiffUtil Item Update
I have endless scroll in my recyclerview, so, it will update when there is new data. and i am using DiffUtil to update data in the recyclerview. DiffUtil does updates the data but whenever there is update data, recyclerview scroll to top and what it…

Win Phyoe Thu
- 213
- 2
- 9
2
votes
1 answer
Reset Recycler view decoration with diff utils
I have a grid recycler view that I update using diff utils, but if something in the list data causes an item to go from any row below the first row, up to the first row then the decoration lacks padding top, this is kind of expected as I'm only…

martinseal1987
- 1,862
- 8
- 44
- 77
2
votes
2 answers
DiffUtil.ItemCallback doesn't update item position (after a deleting)
I use a binding for a ListAdapter with the definition of a DiffUtil.ItemCallback. When deleting items (at least 2) I have an IndexOutOfBoundsException.
The update of the list works (the number of elements is indeed N-1 after deletion) but not the…

giles jeremy
- 95
- 2
- 8
2
votes
1 answer
onBindViewHolder not called after calling diffResult.dispatchUpdatesTo(this)
I am setting my data to recycler view by this :
public void setData(List newNotifications) {
DiffUtil.DiffResult diffResult = getDiffBetweenNewAndOldList(newNotifications);
diffResult.dispatchUpdatesTo(this);
…

Parth Anjaria
- 3,961
- 3
- 30
- 62
2
votes
0 answers
android DiffUtils.callback IndexOutOfBoundsException: Index: 25, Size: 30
I'm updating a RecyclerView using diff utils callback it seems to work fine except if I click a view in the adapter (this forces the views to essentially shuffle) super fast my app will crash with a IndexOutOfBoundsException: Index: 25, Size: 30,…

martinseal1987
- 1,862
- 8
- 44
- 77
2
votes
0 answers
Diff Util causing non responsiveness Android
I have created my own custom filter view, much like the autocomplete text view.
So to explain, I pass in the full list to the adapter, after the user enters 3 or more characters I then filter the list and display using diff util. This is all done…

DJ-DOO
- 4,545
- 15
- 58
- 98
2
votes
3 answers
RecyclerView and DiffUtil with animations crash with IndexOutOfBoundsException: Inconsistency detected
We have an app that can update based on push notifications. What we've found is that sometimes with RecyclerViews that use animations and DiffUtil, the animations crash the app. It seems internally the recyclerview is animating views while…

wshelor
- 363
- 2
- 14