I need to iterate through all the RadioGroups
in my RecyclerView
.
Code i tried:
for(int i=0;i<recyclerView.getAdapter().getItemCount();i++)
{
radioGroup = recyclerView.findViewHolderForAdapterPosition(i).itemView.findViewById(R.id.radio_group);
}
but findViewHolderForAdapterPosition(i)
returns null
for RadioGroups that are off screen and gives me a NullPointerException
.
How do i iterate through all of them?