I have a function that remove two rows of my RecyclerView
(writen in Kotlin) that contain 1,2,3,4,5,6,7,8. I expect to have remain 1,4,5,6,7,8
fun remItemFromList() {
itemList.remove(1)
notifyItemRemoved(1)
itemList.remove(1)
notifyItemRemoved(1)
}
Upon execute the function, the last item i.e. double 8 appear, as per illustrated in the GIF below. Why, and how to solve this?
I manage to achieve what I want using DiffUtil. More elaboration in https://medium.com/@elye.project/simultaneous-insertion-and-removal-of-recyclerview-with-animation-f9e1800a3dd0#.3evndq4is.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With