How To Display 3 Fragments Inside Pageviewer
Inside a fragment, Im trying to create a ViewPager with 3 fragments that you can swipe between. Im having trouble understanding the structure and the errors Im getting.. public cla
Solution 1:
Use this
@Overridepublic Fragment getItem(int position) {
switch (position) {
case0: // Fragment # 0 - This will show FirstFragmentreturn FirstFragment.newInstance(0, "Page # 1");
case1: // Fragment # 0 - This will show FirstFragment different titlereturn FirstFragment.newInstance(1, "Page # 2");
case2:
return FirstFragment.newInstance(2, "Page # 3");
default:
returnnewFragment();
}
}
You should have 3 switch cases and also your default case should not return null
Post a Comment for "How To Display 3 Fragments Inside Pageviewer"