onLoadFinished not called on offscreen fragment un

2019-07-04 16:02发布

问题:

I'm trying to implement List->Detail scheme with details pagination.

I've single Activity for ListView and different Activity with ViewPager. In FragmentStatePagerAdapter.getItem i instatniate new fragment for page and pass item id via setArguments Bundle.

After opening pager Activity two Fragment pages are created and onCreate, onCreateView, onActivityCreated being called.

BUT

onLoadFinished is called only for first Fragment (currently visible). If i go back onLoadFinished is called for second Fragment.

Strage thing is that when i swipe to second (onLoadFinished for third not called), back to first and again go forward to second OnLoadFinished is called for third fragment and every next - after going back and forward always next fragment is being fully created in advance.

Is this bug or feature? How fully loading can be forced?

回答1:

We've solved this by manually calling onStart and onResume in onCreate.. Then onLoadFinished is called