0

I have a RecylerView I want to change active position items view with using recylerView.findViewHolderForAdapterPosition(position)

my problem starts here

if i scroll to recylerview and position not show on screen i call recylerView.findViewHolderForAdapterPosition(position) and this method return null

How can I load all adapter data once and use

for(i = 0; i<adapter.size(); i++){
     View v = recylerView.findViewHolderForAdapterPosition(position).itemView;
}
akhilesh0707
  • 6,709
  • 5
  • 44
  • 51
Burak Durmuş
  • 957
  • 10
  • 16

2 Answers2

0

To make changes to the RecyclerView, you need to change its Adapter. It is not possible by design to modify the RecyclerView child views by hand.

If you want to change the active position, you could have a int activePosition member in your Adapter and call adapter.notifynotifyDataSetChanged() when you change it.

mbonnin
  • 6,893
  • 3
  • 39
  • 55
0

recylerView.getAdapter().getCount();

may be it help you.

Umesh AHIR
  • 738
  • 6
  • 20