0

I'm developing an Android app. I have a RecyclerView, and I can expand my items (several at the same time). The problem ocurrs when the orientation changes. I have a ViewModel, so the data is loaded again. But the items expanded are lost.

What is the best way to keep items expanded after a change of orientation?

android:configChanges="orientation" in Manifest isn't an option

neyogiry
  • 79
  • 5
  • If the items expanded are lost you lost the state somehow . Add adapter and View model code with question . – ADM Jul 17 '20 at 04:32

1 Answers1

0

I would save the expanded/collapsed state to the ViewModel and then apply the saved states when a configuration change occurs.

Rüdiger
  • 1,674
  • 1
  • 20
  • 28