I have 20 FragmentActivity, they all represent like the game screens with different mechanics. I want to put them all in ViewPager. The only thing that comes to mind is this dummy code:
public static class MyAdapter extends FragmentPagerAdapter {
@Override
public Fragment getItem(int position) {
switch(position){
case 0:
return new Fragment1();
case 1:
return new Fragment2();
.........................
another 20 case statements here
.........................
case 20:
return new Fragment21();
}
}
}
But there should be another way to do it. Will appreciate any help.