Code example for FragmentStatePagerAdapter

Methods: setPrimaryItem

		public void setPrimaryItem(ViewGroup container, int position,
				Object object) {
			// TODO Auto-generated method stub 
			super.setPrimaryItem(container, position, object);
		public Fragment getItem(int i) {
			ImageFragment fragment = new ImageFragment();
			Bundle args = new Bundle();
			args.putInt(Constants.SELECTED_IMAGE_INDEX, i); 
			return fragment;
		public int getCount() { 
			return FileUtils.listFiles(context.getFilesDir(), 
	        		Constants.extensions, true).size(); 
Connect your IDE to all the code out there  Get Codota for Java