package com.example.app_10p5; /** * Created by Jean-loup Beaussart on 24/04/2016. */ import android.app.Fragment; import android.app.FragmentManager; import android.support.v13.app.FragmentStatePagerAdapter; class PagerAdapter extends FragmentStatePagerAdapter { private final int mNumOfTabs; public PagerAdapter(FragmentManager fm, int NumOfTabs) { super(fm); this.mNumOfTabs = NumOfTabs; } @Override public Fragment getItem(int position) { switch (position) { case 0: return new TabFragment1(); case 1: return new TabFragment2(); case 2: return new TabFragment3(); case 3: return new TabFragment4(); default: return null; } } @Override public int getCount() { return mNumOfTabs; } }