For the More Curious: How ViewPager Really Works

The ViewPager and PagerAdapter classes handle many things for you behind the scenes. This section will supply more details about what is going on back there.

Two caveats before we get into this discussion: First, according to the documentation, ViewPager is still under development, so these interfaces could change in the future. Second, you do not need to understand the nitty-gritty details in most cases.

But if you need to implement the PagerAdapter interface yourself, you will need to know how the ViewPager-PagerAdapter relationship differs from an ordinary AdapterView-Adapter relationship.

So why is ViewPager not an AdapterView? There is an AdapterView subclass called Gallery that behaves ...

Get Android Programming: The Big Nerd Ranch Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.