@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ImageUtil.initImageLoader(this); int pos = getIntent().getIntExtra("pos", 0); imgs = getIntent().getStringArrayListExtra("Images"); setContentView(R.layout.activity_viewpager_example); ExtendedViewPager mViewPager = (ExtendedViewPager) findViewById(R.id.view_pager); mViewPager.setAdapter(new TouchImageAdapter()); mViewPager.setCurrentItem(pos); }
@Override public View instantiateItem(ViewGroup container, int position) { final TouchImageView img = new TouchImageView(container.getContext()); loader.loadImage( imgs.get(position), ImageUtil.getImageOption(R.mipmap.icon_menu_4), new SimpleImageLoadingListener() { @Override public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) { img.setImageBitmap(loadedImage); } }); container.addView( img, LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT); return img; }
@Override protected void onResume() { super.onResume(); ImageUtil.initImageLoader(this); }