0

I have a RecyclerView with some Views in it, and I need to iterate over all of them, not only the visible ones.

I tried to store all the ViewHolders after their creation but that didn't work

I also thought of creating all the Views manually and storing them, and then passing them to a ListView to display them, but I have no idea how to implement a ListView with a complete View list, since this cannot be done with an Adapter. (right?)

Is there any solution for this?

Edit: This question didn't quite solve my problem, as it basically says "The views are recycled", however I was searching for a way to store the views and pass them to the Adapter without them being recycled (=destroyed/recreated). By now I figured that a ScrollView is the way to go for that.

Finni
  • 429
  • 5
  • 17
  • 3
    Possible duplicate of [How do iterate through all the views/items in a RecyclerView?](https://stackoverflow.com/questions/50947445/how-do-iterate-through-all-the-views-items-in-a-recyclerview) – Margarita Litkevych Nov 17 '19 at 18:46
  • the `visible ones` are `all of them`. RecyclerView does not have separate views for all the items, it reuses the visible ones. – Vladyslav Matviienko Nov 17 '19 at 19:07
  • @VladyslavMatviienko I do know that, however I don't know how to articulate my problem any better. I know that the views are recycled, I just want a ListView with a list of views I can access any time... – Finni Nov 17 '19 at 20:00
  • 1
    that won't be `ListView` anymore. It will be just a ScrollView with all the views. Please instead of thea explain why you want to manipulate all the views? – Vladyslav Matviienko Nov 17 '19 at 20:12

1 Answers1

0

@Vladyslav Matviienko sparked the idea that fixed my problem:

I just use a custom ScrollView now, which allows me to access all the views anytime.

Finni
  • 429
  • 5
  • 17