As the title suggests, I want to retain my fragments. I have enforced my app orientation to always be in landscape mode in the manifest file so that there will be no rotations.
I have read: Understanding Fragment's setRetainInstance(boolean) and Why use Fragment#setRetainInstance(boolean)? However, I am not sure if they apply to my situation.
My project consists of a ViewPager
with swipe tabs. How can I ensure that the fragments used in the ViewPager are the same ones as created when the MainActivity first starts? Would I use the same tagging method and findfragment
by tag?
Additionally, where would it be best to check for the tagged fragment, else create a new fragment?
Just a side question related to ViewPager: what can I do to immediately create all fragments used in the ViewPager when the mainactivity
is started, rather than to wait for a swipe event to occur?