Beginning RecyclerView - Part 11: Nested | Ray Wenderlich Videos

Create a nested RecyclerView, learn about LinearSnapHelper, and improve performance with a RecycledViewPool.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/4568-beginning-recyclerview/lessons/11

I have some problem with part

holder.itemView.foodRecyclerView.recycledViewPool = viewPool

I am not able to compile due to issue

val cannot be reassigned

Can you please help me with this?
Thanks
yogaboy

Hi @yogaboy, thanks for the question! It’s possible this could be due to a change in the RecyclerView library. Which version of the library are you using? This also may have changed in AndroidX.

You could try changing the line to this to see if it helps:

holder.itemView.foodRecyclerView.setRecycledViewPool(viewPool)

Let me know if that helps and thanks again!

Dear @macsimus
Solved! I’m so sorry for my stupid question. You are right!

holder.itemView.foodRecyclerView.setRecycledViewPool(viewPool)

Of course I am using AndroidX library and I try to find in
RecyclerView.RecycledViewPool  |  Android Developers what’s changed but I was blind… totally blind …

Thank you!