package com.example.kailash.tabview;
import android.content.Context;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
public class MyAdapter extends FragmentPagerAdapter {
private Context myContext;
int totalTabs;
public MyAdapter(Context context, FragmentManager fm, int totalTab) {
super(fm);
myContext = context;
this.totalTabs = totalTabs;
}
@Override
public Fragment getItem(int i) {
switch (i) {
case 0:
HomeFragment homeFragment = new HomeFragment();
return homeFragment;
case 1:
game sportFragment = new game();
return sportFragment;
case 2:
MovieFragment movieFragment = new MovieFragment();
return movieFragment;
default:
return null;
}
}
@Override
public int getCount() {
return totalTabs;
}
}