3

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?

user2759617
  • 597
  • 1
  • 8
  • 20
  • `instantiateItem` of PagerAdapter is called every time fragment is accessed or created from ViewPager. If fragment is not created at this moment, `getItem` will get called. – Tixeon Oct 12 '17 at 04:04

1 Answers1

2

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 ?