Okay I know this has been asked previously but just hear me out !
ISSUE
I want to save state of a fragment and then retrieve it in onCreateView method .
I have a ViewPager in my MainActivity with Four Fragments in it .
I have used viewpager.setOffscreenPageLimit(2) so fragments does not get recreated if am in any of two adjacent fragments but if i am in my first fragment and i go to fourth one then fragment first gets recreated .
and if save it in onSaveInstance inside fragment then that does not get called until host activity's same method is not called , which will not get called if am just swiping between fragments
Answer here also has same problem , it is saving fragments in host activity's onSaveInstance method .So i know how to save fragments state and retrieve it if my host activity gets recreated but what if only fragments gets recreated ?
So How can i save state of a fragment without depending on host activity and then retrieve it in onCreateView method of fragment ?
UPDATE Just realized how dumb a person can be , data was there all the time i was not just refilling the views with it .
Thanks in advance.