Recyclerview And Indexoutofboundsexception: Invalid Index #, Size Is #
I have a simple RecyclerView and I want to remove those items onClick. I was continuously running into a crash depending on when I clicked on certain items in the list with the abo
Solution 1:
publicvoidonBindViewHolder(final CardViewHolder holder, finalint position)
Using position here is useful for some things, but if I used it when removing items from the list, it was causing a crash, instead using:
holder.getAdapterPosition();
resolved my issues immediately.
Post a Comment for "Recyclerview And Indexoutofboundsexception: Invalid Index #, Size Is #"