Skip to content Skip to sidebar Skip to footer

Items In Recyclerview + Listadapter Won't Redraw On Update

I'm setting up a RecyclerView that uses a ListAdapter to calculate animations on changes. The RecyclerView is receiving data through a ViewModel that fetches a list via Firebase. T

Solution 1:

It seems to me that your data is updating but the RecyclerView is only updating the order and not the item's view. Try calling your adapter's notifyDataSetChanged() after you update an item in your view.

Solution 2:

Remember that your views are being recycled, meaning if you have for example a checkbox that was check in position 0. Scrolling will make that checkbox to be reuse in some item thus you may see other item that was checked as well even though you never check it. Always save the state of your view as it will be recycle. You can use your POJO/model to save the state with a boolean field.

Also when working with DiffUtil make sure it is a different instance of list not reusing the old one because it may not update your data.

You may also want to change this adapter.submitList(new LinkedList<>(mensas)); to just this adapter.submitList(mensas);

Post a Comment for "Items In Recyclerview + Listadapter Won't Redraw On Update"