Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How set custom downloader in Universal Image Loader?

how to set my custom downloader? I cannot see a Builder method to change the downloader class.

I want use Google HTTP Client library and I have a subclass ready, like this:

import com.nostra13.universalimageloader.core.download.BaseImageDownloader;

public class GoogleHttpDownloader extends BaseImageDownloader {

    //constructors, etc...
    @Override
    protected InputStream getStreamFromNetwork(String imageUri, Object extra)
        throws IOException {
        //new instancce of client, connect, return stream
    }
}

But, how to make UIL to use?

Thanks.

like image 451
Vinz486 Avatar asked Jun 18 '13 08:06

Vinz486


1 Answers

ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context)
        ...
        .imageDownloader(new GoogleHttpDownloader())
        ...
        .build();
ImageLoader.getInstance().init(config);
like image 106
nostra13 Avatar answered Sep 30 '22 01:09

nostra13