Android recyclerView findViewHolderForAdapterPosition returns null

According to the official documentation:

if notifyDataSetChanged() has been called but the new layout has not
been calculated yet
, this method will return null since the new
positions of views are unknown until the layout is calculated.

It’s not safe to use findViewHolderForAdapterPosition().

While you call this method after listView.swapAdapter(listadapter, false); you’ll always get a null as result because notifyDataSetChanged() will be called.

Leave a Comment