I found a very weird behaviour of view pager. While using FragmentPagerAdapter, I observed getItem() was called in correct order i.e. position 0, position 1, position 2...... but the onCreateView() is called in opposite order, i.e. position 2, position 1, position 0. (assuming viewpager maintaining 3 offscreen pages) What I think, that Viewpager is somehow maintaining a stack of these fragments. When it require to create views, it pop of top most active fragment from the stack and make it to call it's onCreateView().
So my question is can we control the order of calling of onCreateView()? If not, can I order the network requests which I make when onCreateView() is called, such that Fragment 0 network requests should be executed first, then Fragment 1, then Fragment 2. But I think this would create another problem, as I'm performing UI related task after network request completed and if onCreateView() is not called till now, then UI elements might not be initialized. So what is the best way to make these network calls to be in right sequence, i.e. for Fragment 0, then 1, then 2 and so on....