Augment Android's ViewPager with wrap-around functionality

Infinite View Pager

With a normal ViewPager, you can only scroll from the first page to second page (and so forth), from left-to-right. Once you reach the last page, your only option is to scroll backwards, right-to-left. In other words, 'wrap-around scrolling' (going from first-to-last, and last-to-first) is not possible.

Wrapped scrolling should now be possible with your ViewPager. The pages you see are not duplicates - each page from your PagerAdapter is only created once and then reused. This means you do not have to worry about managing multiple instances of the same Fragment.

Caveats

It is only possible to achieve wrapping when you have at least 4 pages. This is because of the way the ViewPager creates, destroys, and displays the pages. No fix for the general case has been found.