Skip to content Skip to sidebar Skip to footer

Recyclerview Mixing Up Items

I have a RecyclerView that displays a list of images and text that are downloaded from the internet via a RecyclerView adapter. The problem arises when I scroll up and down the Rec

Solution 1:

It was actually a problem in my adapter implementation. I had a Cursor in the overriden onBindViewHolder method and every time it called cursor.moveToNext() the cursor would move forward unless it was the last row in the database. At that point it would stop on that last row. So when I scrolled up the screen, the recyclerview worked perfectly, except now it showed me the same data from the last row that the cursor had given it. I thought this might have been a recyclerview bug initially, but as it turns out, this was a bug in my code. To solve it I simply changed cursor.moveToNext() to cursor.moveToPosition(position) and it started displaying results as expected.


Post a Comment for "Recyclerview Mixing Up Items"