Skip to content

Instantly share code, notes, and snippets.

@laaptu
Created October 13, 2014 09:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save laaptu/252861a6562f6f315807 to your computer and use it in GitHub Desktop.
Save laaptu/252861a6562f6f315807 to your computer and use it in GitHub Desktop.
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