Skip to content Skip to sidebar Skip to footer

Properly Interacting With Fragments In Fragmentpageradapter

I'm using a FragmentPagerAdapter for an activity, to page between 3 fragments, in addition to a ViewPager. Based on input from the first fragment (markers on a google map), I'm mak

Solution 1:

OnSelect(page2 ) when you do the API calls and get your API call result , there should be a callback to update an object referenced by the API for 'OnSaveInstanceState'.

If you do that then IMO , here is what u get from the framework:

API returns results

results update a fragment that fragment gets processed by any call to 'OnSaveInstanceState'

OnOrientationChange :: with condition that it occurs AFTER the API returns results Fragment is saved with state reflecting the API results

Activity is recreated due to Orientation change on SavedInstanceState != null it reinstantiates the fragment from the state including the residue of the earlier api call....

see accepted answer here for additional detail

Post a Comment for "Properly Interacting With Fragments In Fragmentpageradapter"