开发者

How to "activate" a FragmentTab when selected, and not before?

I'm using FragmentTabsPager, and when my app starts, both tabs initiate net-requests to fetch their content....I would expect th开发者_运维问答e first tab to load onAppStart, and the second tab to load when it is clicked, this is not the case as they are both loading simultaneously onAppStart. This is because the FragmentTabsPager lifecycle is causing any of the onXXX methods to call in all the Fragments.....

What method will allow me to load data when the FragmentTab is actually selected?


Use the FragmentTabs adapter model in the API samples http://developer.android.com/resources/samples/Support4Demos/src/com/example/android/supportv4/app/FragmentTabsPager.html

In your implementation of onTabChanged, do your network initialization of the child fragment

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜