How can i just download image with universal-image-loader

scott picture scott · Apr 15, 2013 · Viewed 16.5k times · Source

as far as I know, universal-image-loader provide 2 kinds of methods to display images. imageLoader.loadImage and imageLoader.displayImage. But those 2 methods must bind to UI element to display. Can I just download files for cache in a thread (for future display). I don't need to display those image right now.

Answer

Robin Srivastava picture Robin Srivastava · Dec 23, 2013

You can still use UIL. Based on the displayOptions used below the images would be cached.

Refer here - https://github.com/nostra13/Android-Universal-Image-Loader

// Load image, decode it to Bitmap and return Bitmap to callback

imageLoader.loadImage(imageUri, displayOptions, new SimpleImageLoadingListener() {
    @Override
    public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
        // Do whatever you want with Bitmap
    }
});