Android PagerAdapter, get current position

CQM picture CQM · Dec 16, 2011 · Viewed 39.4k times · Source

I want to get the current position of the visible view of my PagerAdapter

I didn't see an obvious function like getPosition() and I want one.

I want to add an object into its arraylist at that position, but I need to know it first

Answer

Jona picture Jona · Dec 17, 2011

You would use:

int position = mViewPager.getCurrentItem()