First of all, I am using FragmentStatePagerAdapter to feed a ViewPager with fragments to display.
When app is in the running state (i.e. after onResume()
), calling setAdapter on the ViewPager will always work and make my ViewPager refresh, the getItem(int position)
method in the adapter is called.
However after an orientation change, if I call setAdapter in the onCreate(Bundle savedInstance)
method of my activity, the getItem(int position)
method is not called, and the old fragment is reused.
I am thinking maybe the FragmentManager is doing something that I don't understand? The Fragment Manager is the only thing that doesn't get destroyed during the orientation change.
Thanks