Code example for FragmentStatePagerAdapter

0
import com.f2prateek.dfg.model.DeviceProvider; 
 
public class DeviceFragmentPagerAdapter extends FragmentStatePagerAdapter { 
 
  public DeviceFragmentPagerAdapter(FragmentManager fm) { 
    super(fm); 
  } 
 
  @Override 
  public Fragment getItem(int position) { 
    return DeviceFragment.newInstance(position); 
  } 
 
  @Override 
  public int getCount() { 
    return DeviceProvider.getDevices().size(); 
  } 
}