RecyclerView: how to clear cached/recycled views?

Use

recyclerView.getRecycledViewPool().clear();

I had the same problem. The solution suggested by Mann works well. An other option would be to set the RecycledViewPool of the RecyclerView to a new instance. That works for me as well.

recyclerView.setRecycledViewPool(new RecyclerView.RecycledViewPool());

But I think overriding the getItemViewType() is the cleaner solution.


It sounds like the accepted answer is the right one for your case, returning a different viewType is probably what you needed to do.

If anyone does need to find a way to clear cached view holders and ended up in this thread, here is what I found that worked.

You need to call setLayoutManager(null) and setAdapter(null). If you want to keep your adapter, you can do something like adapter = getAdapter(); setAdapter(null); setAdapter(adapter);