简体   繁体   中英

When is android PagerAdapter's instantiateItem called?

I have a viewpager and a pagerAdapter which inflates a custom view and adds it to the collection. After setting up the viewpager and pageradapter, I proceed to get some data which I now want to display in one of the custom views. However I observed that the pagerAdapter.instantiateItem is not being called by that time. How can I get the viewpager to start instantiateItem right away?

instantiateItem is called when the viewPager calls the getItem method. When the viewPager is first displayed, getItem is called for the currently displayed tab and the following tab.

Could you provide a code snippet for further details ?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM