Questions tagged [android-diffutils]

Questions related to Android DiffUtil utility class for calculating difference between two lists

121 questions
12
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…
10
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…
10
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…
Stackpile
  • 181
  • 1
  • 9
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…
6
votes
3 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);…
5
votes
3 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
  • 798
  • 9
  • 28
5
votes
1 answer

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
  • 304
  • 3
  • 10
4
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…
4
votes
1 answer

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…
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…
4
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…
3
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 …
3
votes
1 answer

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…
3
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…
3
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…
1
2 3
8 9