Person
Person

Reputation: 345

How to set universal image loader to download a picture once?

I'm using universal image loader.
I want to download a picture from url and show it in my application.
I'm sure that i'll never change the picture in my site.
So I need it to be downloaded once. and don't even check the date of modification to download it.

In fact I want the app to check if the image was downloaded the don't download it :)

How can I do this.

Thank you

Upvotes: 0

Views: 112

Answers (2)

duggu
duggu

Reputation: 38439

On universal loader if you are true cacheInMemory then it maintain cache and your image download once. By default it is false:-

DisplayImageOptions defaultOptions = new DisplayImageOptions.Builder()
        ...
        .cacheInMemory(true)
        .cacheOnDisk(true)
        ...
        .build();
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(getApplicationContext())
        ...
        .defaultDisplayImageOptions(defaultOptions)
        ...
        .build();
ImageLoader.getInstance().init(config);

for more info you have to read below link:-

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

Upvotes: 1

MilapTank
MilapTank

Reputation: 10076

instead of download image you should keep in drawable and use it if you are download image via UID its save in catch memory and it is removable you can clear that catch once it is clear than you have to download again if you sure that you want download once only than i suggest go for drawable not for UID unless you have specific requirement

Upvotes: 1

Related Questions