Questions related to Android DiffUtil utility class for calculating difference between two lists
Questions tagged [android-diffutils]
180 questions
0
votes
1 answer
DiffUtil not calling onBindView or refreshing ViewHolder
I tried to use DiffUtil approach to update my list which always consist of 30 items, now each item data updates every minute but no way of telling if all item's data will have updates so to avoid abusing notifyDataSetChanged() I create a class…

Undefined function
- 138
- 1
- 13
0
votes
2 answers
(android) Can I use this code in my DiffUtill implementation?
I am now making a DiffUtil class to update only changed items in the RecyclerView.
I have seen several other sample code.
When comparing two objects, they compared unique values such as id defined in the Model(Data) class in…

ybybyb
- 1,385
- 1
- 12
- 33
0
votes
1 answer
DiffUtil.ItemCallback areItemsTheSame() method check items twice
I send request to /list.php?page=1 and display data in UI with Paging 3 component.
In first request, areItemsTheSame(new, old) method do nothing. No log in Logcat.
Then i refresh data with SwipeRefreshLayout and request sent same api…

Cavid
- 109
- 8
0
votes
1 answer
Diffutils with object that has a list of items
Hopefully someone can help me out. How would you go about using diffutils for an object that has a list of objects. So for quick example, may not make sense but to get a better idea.
data class Exercise(
val name: String,
var sets: String,
…

huey77
- 643
- 1
- 9
- 24
0
votes
1 answer
How to queue the same method call in Kotlin/Java
I use DiffUtil to calculate for data changes in RecyclerView. The calculation is done on schedulers thread asynchronously with RxJava like below:
fun setResultItems(list: List?) {
Log.d("debugfilter", " …

Inas
- 134
- 1
- 2
- 12
0
votes
1 answer
Android Fragment LiveData observer is not triggered when update is done on a record data
I am trying to figure out why the LiveData observer for getAllGoals() does not trigger immediately in the fragment when I update a record. However, the observer is called only after switching to another fragment using the bottom tab navigation and…

Nitish Anand
- 51
- 6
0
votes
1 answer
Recyclerview data is changed without specify it
I'm performing some operations in my model list to be passed after to recycler adapter and update the adapter list. For some unexpected reason the adapter list has been updated before i pass the new list. I'm using DiffUtil to calculate the…

Oscar Ivan
- 819
- 1
- 11
- 21
0
votes
0 answers
Java Kotlin Generic passing a class getter as parameter in function
I m doing something about the android DiffUtil and i want to make it generic.I want to pass the getter function (itemGetter) when creating the class A but when i declare the type of itemGetter in the constructor. I don't know how to declare it.…

yuk
- 49
- 8
0
votes
1 answer
ListAdapter does not fill the adapter on 2nd fragment of application
I have an application with 2 fragments, both have lists that are being filled from the same adapter.
The first one works correctly, but the second one -
class CountryBordersFragment : Fragment(R.layout.fragment_country_borders) {
private…

Alon Shlider
- 1,187
- 1
- 16
- 46
0
votes
0 answers
Recyclerview still freeze/lags while scrolling with DiffUtil on background thread
I have a recyclerview with 20-60 items. I'm using Room+Livedata and Diffutil. The Recyclerview generally updates 2-3 times in a second. Items doesnt change only the items' content modified such as the percentage changes of a currently downloading…

Orhan Kurtulan
- 73
- 1
- 1
- 5
0
votes
0 answers
Why DiffUtil Doesn't throw a ClassCastException when using Kotlin Sealed class
I am using sealed class with Android List Adaptor in which 2 different objects are merged into one single list. Last item in the list is just a add more layout(Like Header). I am using DiffUtils and noticed that even i cast newItem to Object1 it…

Manoj Chouhan
- 21
- 3
0
votes
0 answers
How to save reference to the old list with DiffUtil
I created my DiffUtil like this:
class DiffUtilCall extends DiffUtil.ItemCallback {
@Override
public boolean areItemsTheSame(@NonNull Cars oldItem, @NonNull Cars newItem) {
return oldItem.getTitle().equals(newItem.getTitle());
…

Noam
- 485
- 1
- 7
- 18
0
votes
2 answers
Update recyclerview adapter from other adapter
What I want - I've category recyclerview and quoteList recyclerview. when user clicks on any of the category it should display/animate the quote for that category.
The problem - 1. Now I have tried setting list from category adapter to my quote…

Rohit Chauhan
- 1,119
- 1
- 12
- 30
0
votes
0 answers
unable to update specific values using Diff Util
I have a app to shows a list of items. I need to update only the price textview of the item whenever the price get changed. But the whole list is getting updated in the recyclerview.
I'm using DiffUtil from this Library In the below example, When…

Arulnadhan
- 923
- 4
- 17
- 46
0
votes
0 answers
When checking the checkbox it updates other rows in recyclerview. DiffUtils and DataBinding used to update and bind data
I am trying to implement a Task creating app. The user should be able to check the task to mark it as completed. But when the checkbox of more than one viewholder is pressed in recyclerview it starts updating the other rows.
Suppose I have 3 rows -…

Anush Hakobyan
- 11
- 4