Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
public class ViewPagerAdapter extends FragmentPagerAdapter {
private Context _context;
public static int totalPage=2;
public ViewPagerAdapter(Context context, FragmentManager fm) {
super(fm);
_context=context;
}
@Override
public Fragment getItem(int position) {
Fragment f = new Fragment();
switch(position){
case 0:
f=LayoutOne.newInstance(_context);
break;
case 1:
f=LayoutTwo.newInstance(_context);
break;
}
return f;
}
@Override
public int getCount() {
return totalPage;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment