Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
FragmentStateAdapter select current fragment. Viewpager select current fragment
int id = viewPager.getCurrentItem();
System.out.println(id);
FragmentStatePagerAdapter adapter = (FragmentStatePagerAdapter) viewPager.getAdapter();
Fragment fragment = (Fragment) adapter.instantiateItem(viewPager, viewPager.getCurrentItem());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment