Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to display only cache memory images in ViewPager using Universal Image Loader Android?

I want to display only those images that were loaded into cache memory once we downloaded from url using Universal Image Loader

Example

I have 15 URLS to download image and display inViewPager, but out of them only 5 were downloaded and i closed the app.. Now i don't have any internet connection to get all the other images from web, but app will show only 5 images and remaining pages will be blank..

Is is possible to get the list of only those images from cache Memory??

How can we restrict ViewPager from other blank pages?

I have successfully implemented Universal Image Loader, but got stuck on these issues.

Any idea/suggestion/sample would be appreciated..

Thanks

like image 440
moDev Avatar asked Feb 18 '23 00:02

moDev


1 Answers

You can define whether image was cached on disc using disc cache:

File cachedImage = imageLoader.getDiscCache().get(imageUrl);
if (cachedImage.exists()) {
    /// image is cached
}

You can check every image URL, define which images are cached and configure ViewPager appropriately.

like image 59
nostra13 Avatar answered Apr 30 '23 13:04

nostra13