I have a viewpager with 4 fragments. The first time contains an expandable list view which allows the user to chose something. However when I swipe to the third fragment the view of the first one gets destroyed, so if I swipe back to the first one I don't see the user's selection anymore. Is there a way I can save the state of the first fragment such that when I swipe back from the third or the forth fragment I still will be able to see what the user selected?
Note: I did try to use the setOffscreenPageLimit()
method, however it gave me another problem. The last fragment is supposed to send a report with user data, and reset the whole viewpager to the initial state, in case of setOffscreenPageLimit()
after sending the report, I still had all the fragments with the user selection.
Thanks in advance.