Code example for FragmentStatePagerAdapter

Methods: setPrimaryItem

0
		} 
		@Override 
		public void setPrimaryItem(ViewGroup container, int position,
				Object object) {
			// TODO Auto-generated method stub 
			super.setPrimaryItem(container, position, object);
		} 
		@Override 
		public Fragment getItem(int i) {
			ImageFragment fragment = new ImageFragment();
			Bundle args = new Bundle();
			args.putInt(Constants.SELECTED_IMAGE_INDEX, i); 
			fragment.setArguments(args);
			return fragment;
		} 
 
		@Override 
		public int getCount() { 
			return FileUtils.listFiles(context.getFilesDir(), 
	        		Constants.extensions, true).size(); 
		}