recycler view data changes when orientation is changed in android I have an activity where I'm showing card view list inside recycler view and in that recycler view I have another recycler view wrapped in expandable layout, which contains user information about total of 6 users. The problem I'm facing is that when I rotate screen for landscape mode the data of 6th user changes i.e. it is supposed to display 3 attributes when layout is collapsed and 6 attributes of a single user when it is expanded but instead it displays 1 attribute in collapsed mode and the other 3 when it is expanded, it disappears the attribute at 2nd and 3rd position and it doesn't even display image view that will be used to expand it but it still expands the layout, below are the screenshots attached and please do know that I already have separate layout for landscape mode:
screenshots of how it should behave in landscape mode too
portrait mode and not expanded
portrait mode and expanded
screenshots of how it is behaving in landscape mode
landscape mode and not expanded, as u can see record number2 and 3 is disappeared and arrow image view too
landscape mode and expanded, it still expands if I click at bottom and all the records inside second recycler view are visible properly
I have already tried using configchanges and it doesn't work. I also know that it can be achieved with onsaveinstance too but I can't find any proper tutorial of how to do it