Android PagerAdapter X of Y

Recently saw NumericPageIndicator¬†noted in the Android developer weekly email and thought I’d share my simpler solution to having page X of Y in a view

Gmail's X of Y pager

Gmail’s X of Y pager

pager indicator.

PagerAdapter X of Y. When using a view pager you can simply override the getPageTitle to create a page x of y text as seen in apps like gmail. This was used in a app to swipe through the RSS stories with android.support.v4.app.FragmentPagerAdapter.

Alternatively you could use something like https://github.com/ManuelPeinado/NumericPageIndicator 

Gist after the break