Closed chijikpijik closed 10 years ago
Correct. New children should never be added to a RecyclerView
directly in the layout manager. The views it adds should always be obtained from the attached RecyclerView.Adapter
, so that they are properly accounted for and have a valid ViewHolder
attached.
Hi,
I am facing the same problem, but I obtained the view from the adapter, like this:
for (int i = 0; i < getItemCount(); i++){ View newBadge = recycler.getViewForPosition(i); }
Thanks for your help!
Error: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.support.v7.widget.RecyclerView$ViewHolder.isRemoved()' on a null object reference
Hi! After trying similar to this (simplify version):
I have an exception:
I can't add to RecyclerView child view without ViewHolder?