ViewPager with FragmentPagerAdapter

Spend one hour trying find how to access my list fragment as there was no explicit fragment ID

1. Get current select view page

ViewPager viewPager = (ViewPager) findViewById(;
int id = viewPager.getCurrentItem();

2. Get Fragment by tag

Fragment frag = getFragmentManager().findFragmentByTag(“android:switcher:””:”+id);

Then you can access your fragment reference.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s