I want to click an item in recyclerView programmatically, I found a way do that:
recyclerView.findViewHolderForAdapterPosition(0).itemView.performClick();
>
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.