How set custom downloader in Universal Image Loader?

感情迁移 提交于 2019-12-05 22:29:31

问题


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.


回答1:


ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context)
        ...
        .imageDownloader(new GoogleHttpDownloader())
        ...
        .build();
ImageLoader.getInstance().init(config);


来源:https://stackoverflow.com/questions/17164340/how-set-custom-downloader-in-universal-image-loader

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!