<reponame>pengyuanqi/pyq_learn_android<filename>AndroidStudioProjects/ViewPager/app/src/main/java/org/hotpoor/pyq/viewpager/MyFragmentPagerAdapter.java
package org.hotpoor.pyq.viewpager;


import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import java.util.List;

public class MyFragmentPagerAdapter extends FragmentPagerAdapter{

    private List<Fragment>fragList;
    private List<String>titleList;
    public MyFragmentPagerAdapter(FragmentManager fm , List<Fragment>fragList , List<String>titleList) {
        super(fm);
        this.fragList=fragList;
        this.titleList=titleList;
    }

    @Override
    public Fragment getItem(int arg0) {
        return fragList.get(arg0);
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return titleList.get(position);
    }

    @Override
    public int getCount() {
        return fragList.size();
    }
}
