Code example for PagerAdapter

0
		setContentView(mViewPager);
 
		mViewPager.setAdapter(new SamplePagerAdapter());
	} 
 
	static class SamplePagerAdapter extends PagerAdapter { 
 
		private static int[] sDrawables = { R.drawable.wallpaper, R.drawable.wallpaper, R.drawable.wallpaper,
				R.drawable.wallpaper, R.drawable.wallpaper, R.drawable.wallpaper }; 
 
		@Override 
		public int getCount() { 
			return sDrawables.length;
		} 
 
		@Override 
		public View instantiateItem(ViewGroup container, int position) {
			PhotoView photoView = new PhotoView(container.getContext());
			photoView.setImageResource(sDrawables[position]);
 
			// Now just add PhotoView to ViewPager and return it