Code example for FragmentPagerAdapter

Methods: instantiateItem

0
		this.fragments.add(frag);
	} 
 
	@Override 
	public Object instantiateItem(ViewGroup container, int pos) {
		final Fragment frag = (Fragment) super.instantiateItem(container, pos);
		this.fragments.set(pos, frag);
 
		return frag;
	} 
 
	@Override 
	public Fragment getItem(int pos) {
		return this.fragments.get(pos);
	} 
 
	@Override 
	public int getCount() { 
		return this.fragments.size();
	} 
}