Questions tagged [android-diffutils]

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

180 questions
0
votes
1 answer

How to write DiffUtil.Callback correctly so that the recyclerview does move animations?

I have a recyclerview adapter of plain old data type, char in my case. The adapter is backed by a list. The setChar method updates the list. Assume in my case that setChar is only called with the same list as the adapter has but only with items…
Daniel
  • 400
  • 1
  • 2
  • 12
0
votes
1 answer

LiveData, DiffUtil and object references

There is LiveData which is a list of users: val users: MutableLiveData> Then it is updated: val usersValues = users.getValues() val user = usersValues[0] user.name = "new-name" users.post(usersValues) And DiffUtil doesn't see different…
eleven
  • 6,779
  • 2
  • 32
  • 52
0
votes
1 answer

Android DiffUtil :: onBindViewHolder returning the position removed from the list

I am trying to remove Items from adapter when Item is clicked The display is doing the right thing but when I click the last item, I get IndexOutOfBound Exception my diff utils the below class ItemListDiffUtilCallBack(val oldList: List, …
Anthony
  • 571
  • 1
  • 4
  • 20
0
votes
0 answers

Do I really need a DiffUtil.ItemCallback to update my RecyclerView if its adapter uses reference to a MutableListView managed by a separate class?

Let's say I have an adapter for a RecyclerView that looks like this: class ContentAdapter( private val data: List, private val itemSelectedListener: OnItemSelected, private val activityUIFocusListener:…
Gensoukyou1337
  • 1,507
  • 1
  • 13
  • 31
0
votes
2 answers

Android RecyclerView Compare the data and update ui acording to it

Hello I am New to Programming i just created an application that get the data from server every second i just wants to changethe background of my RecyclerViews holder's bid and ask position if the data if grater or lower then previous. for example…
0
votes
2 answers

Firebase Realtime Database, ListAdapter, DiffUtil and ViewModel

I am trying to create a list view using Recycler View and display a list. Lets say what I am trying to display is like a typical chat screen - image, message, sender_name etc. So all this data is stored in Firebase Realtime Database. I am also using…
0
votes
0 answers

View Changes not properly

Ok from the Start, I have a RecyclerView where I want to change the color of the entries, if they are clicked. The Recyclerview gets a list from a database, where I added a bool value, if the View is selected. In my holder I check if the view is…
0
votes
1 answer

Submit the same list using AsyncListDiffer, but the recycler view always auto scroll to top

I try to submit the same list using AsyncListDiffer, but the recycler view always auto scroll to top. When I debug I see the recyclerview auto scroll to top after calling submitList before areItemsTheSame method is called class TestPlaceAdapter( …
0
votes
0 answers

live data list r doesn't update with DiffUtil method

i used the google recommendations to create my recycler view with the diff utils but the diff utils doesnt update with my livedata list i have tried everything My Model class data class Note( val Title:String?=null,//column 2 val…
freedom chuks
  • 123
  • 1
  • 8
0
votes
1 answer

Why Recyclerview adapter onBindViewHolder is called more than once?

I use this tutorial to implement DiffUtil in my recyclerview. My aim is to add single item to the bottom of the recyclerview without reloading the rest of the recyclerview. I used firestore addSnapshotListener to call the adapter. The problem is the…
0
votes
0 answers

RecyclerView items disappear after restarting app

I was previously using RecyclerView Adapter and decided to switch to ListAdapter to make use of DiffUtils for the animations. Everything seem to go smoothly at first until I cleared my app from the task switcher (Memory). Once I opened my app again…
0
votes
1 answer

getItemCount or onBindViewHolder not getting called using DiffUtil

I'm updating my list when the user reaches the end of the scroll to get a pagination effect. override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) { super.onScrolled(recyclerView, dx, dy) if…
Manoj Perumarath
  • 9,337
  • 8
  • 56
  • 77
0
votes
1 answer

Can I use hashCode function of a class to verify if both has same value for areContentsTheSame in diffutils callback?

I am trying to implement RecyclerView ListAdapter with DiffUtils callback to only update/insert rows that has been changed not all. To implement I have to override these function from diff utils areItemsTheSame and areContentsTheSame. I can check…
0
votes
1 answer

How to update images in a RecyclerView?

I have a RecyclerView of images that the user is able to edit directly in the RecyclerView itself. The editing part is fine and works well. It's done on a bitmap that overlays the images and then saves any changes to the image file. As soon as the…
John
  • 5,581
  • 6
  • 29
  • 46
0
votes
1 answer

Android DiffUtil inconsistency exceptions when using custom added views like i.e. for empty lists

I need help with the DiffUtil for RecyclerView Adapter. I have made a Custom Adapter with the possibility to add custom Views like a loading view or empty view etc. Everything works fine without using DiffUtil but when I use it I have sometimes an…
Martin S
  • 363
  • 3
  • 14
1 2 3
11
12