Created
July 31, 2014 19:11
-
-
Save XinyueZ/9daad71fcc762982fe72 to your computer and use it in GitHub Desktop.
loop_fragments_in_viewpager
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//one way | |
if (mAdapter != null) { | |
int count = mAdapter.getCount(); | |
SomeFragment f; | |
ViewPager vp = (ViewPager) getView().findViewById(R.id.vp_pages); | |
for (int i = 0; i < count; i++) { | |
f = (SomeFragment) mAdapter.instantiateItem(vp, i); | |
f.refresh(); | |
} | |
} | |
//another | |
//Try to get the fragment at index 0 . | |
SomeFragment someFragment = getSupportFragmentManager().FindFragmentByTag(“android:switcher:” + R.id.viewpager + “:0″); | |
if (someFragment != null) { | |
if (someFragment.getView() != null){ | |
someFragment.refresh(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment