public static class PagerAdapter extends FragmentPagerAdapter {
public PagerAdapter(FragmentManager fm) {
super(fm);
}
@Override
public int getCount() {
return VIEW_COUNT;
}
@Override
public Fragment getItem(int position) {
Fragment fragment = null;
switch (position) {
case 0:
fragment = Fragment1.newInstance(context_);
break;
case 1:
fragment = Fragment2.newInstance(context_);
break;
case 2:
fragment = Fragment3.newInstance(context_);
break;
default:
break;
}
return fragment;
}
}
via http://stackoverflow.com/questions/7445437/replace-fragment-with-another-fragment-inside-viewpager
No comments:
Post a Comment