CQM CQM - 1 year ago 228
Android Question

Android PagerAdapter, get current position

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

I didn't see an obvious function like

and I want one.

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

Answer Source

You would use:

int position = mViewPager.getCurrentItem()
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download