CardStackView icon indicating copy to clipboard operation
CardStackView copied to clipboard

swipe() not working after notifyDataSetChanged Or update adapter

Open devganiyahitesh1 opened this issue 6 years ago • 2 comments

Initial stage all card swiped manually or programmatically worked fine but after get swipe all cards updating adaper with new cards but its not working programmatically swiping and after dragging one card it swipe all card automatically.

devganiyahitesh1 avatar Mar 15 '19 16:03 devganiyahitesh1

don't use notifyDataSetChanged because its reload all items again after notifyDataSetChanged method called, so I will suggest using DiffUtil.

Nice example of DiffUtil :- https://www.journaldev.com/20873/android-recyclerview-diffutil

iamkdblue avatar Mar 17 '19 05:03 iamkdblue

@devganiyahitesh1 @kdblue From my limited testing, it looks like you can use a ListAdapter and only need to implement DiffUtil.ItemCallback. It will do the work that is shown in @kdblue 's link for you, so you have a lot less boiler plate to write.

https://developer.android.com/reference/android/widget/ListAdapter

Barryrowe avatar Oct 23 '19 19:10 Barryrowe