Get data from FragmentActivity with ViewPager to Fragmnet after API response
<p>I have one FragmentActivity that holds ViewPager in which I trough custom FragmentPagerAdapter create 4 child Fragments. Fragments contain ListView in which I show data. I make a call to the web API in FragmentActivity when the response is finished; I want to notify all fragments that data is ready and fill the adapter with that data. Note that data is not available at the time of Fragment initialization. </p>

<p>I could save a reference to fragment when creating it and call “myFragment.hereIsYourData(Object data)”, but the reference get changed after recreating Activity when killing app for low memory. (If I’m not mistaking + I read that keeping a reference to fragment in Activity is a bad thing)</p>

<p>Just for clarification I can’t use “findFragmentById(id)” because ViewPager does’t expose that. I could use the “getFragmentTag” hack explained here <a href="http://stackoverflow.com/a/9744146/1025364">http://stackoverflow.com/a/9744146/1025364</a> but I don’t want to : D.</p>

<p>Then I have tried to ask for data from Fragment onResume method trough interface to Activity (like explained in Developer guide), but the data is not reedy at that moment. Should I ask for data in some sort of a loop until its ready?</p>

<p>What is the best approach in situation like that? </p>
