Search code examples
androiduniversal-image-loaderimageswitcher

How can universal image loader be used to set image to other views other than ImageView?


I need to set an image to an ImageSwitcher by downloading it from server. But the universal image loader seems to take ImageView as a parameter.

I read that we can use ImageAware to display image on any android view.

Can someone help me how to go about this ?

Thanks, Sneha


Solution

  • Use loadImage instead. That will get you a bitmap that you can use to do whatever you want with it.

    // Load image, decode it to Bitmap and return Bitmap to callback
    imageLoader.loadImage(imageUri, new SimpleImageLoadingListener() {
        @Override
        public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
            // Do whatever you want with Bitmap
        }
    });