package com.example.prettywallpapers.prettyadapter;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;

import java.util.List;

public class ViewPaperAdapter extends FragmentPagerAdapter {
    private List<Fragment> fragmentList;
    private String[] tablename;
    public ViewPaperAdapter(@NonNull FragmentManager fm, List<Fragment> list,String[] tabletitle) {
        super(fm);
        fragmentList = list;
        tablename = tabletitle;
    }


    @NonNull
    @Override
    public Fragment getItem(int position) {
        return fragmentList.get(position);
    }

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

    @Nullable
    @Override
    public CharSequence getPageTitle(int position) {
        return tablename[position];
    }
}
