Code example for ImageView

Methods: setImageBitmapsetImageDrawable, setTag

0
                mImageViewReference = new WeakReference<ImageView>(imageView);
            } 
        } 
 
        @TargetApi(Build.VERSION_CODES.HONEYCOMB_MR1)
        @Override 
        protected void onPostExecute(Bitmap bitmap) {
            ImageView imageView = mImageViewReference != null ? mImageViewReference.get() : null;
 
            // If ImageView is still around, bitmap processed OK and this task is not canceled. 
            if (imageView != null && bitmap != null && !isCancelled()) {
 
                // Ensure this task is still the same one assigned to this ImageView, if not the 
                // view was likely recycled and a new task with a different icon is now running 
                // on the view and we shouldn't proceed. 
                if (this.equals(imageView.getTag())) {
 
                    // On HC-MR1 run a quick fade-in animation. 
                    if (hasHoneycombMR1()) { 
                        imageView.setAlpha(0f);
                        imageView.setImageBitmap(bitmap);
                        imageView.animate()
                                .alpha(1f)
                                .setDuration(ANIMATION_FADE_IN_TIME)
                                .setListener(null);