Code example for ImageView

Methods: setOnClickListener

0
 
        // Use the parent activity to load the image asynchronously into the ImageView (so a single 
        // cache can be used over all pages in the ViewPager 
        if (ImageDetailActivity.class.isInstance(getActivity())) {
            mImageFetcher = ((ImageDetailActivity) getActivity()).getImageFetcher();
            mImageFetcher.loadImage(mImageUrl, mImageView);
        } 
 
        // Pass clicks on the ImageView to the parent activity to handle 
        if (OnClickListener.class.isInstance(getActivity()) && Utils.hasHoneycomb()) {
            mImageView.setOnClickListener((OnClickListener) getActivity());
        } 
    } 
 
    @Override 
    public void onDestroy() { 
        super.onDestroy(); 
        if (mImageView != null) {
            // Cancel any pending image work 
            ImageWorker.cancelWork(mImageView);
            mImageView.setImageDrawable(null);