caching - Lazy loading in android -


I want the sluggish load thumbnails of images found in the Listview by Blue Toothu. I saw many implementations of lazy loading in Android, but I was working on the Alia loader, the flow was not understood.

BTW I reference this site

In the above implementation, they use the memory cache as well as the file cache (in the class image loader). I can not find why it is necessary to maintain two cache?
and maintains a map image view in the same class. Why did they need to see the image and mapping the image URL?

Can someone explain the flow of the above code or give some suggestions on designing their own alihaalar class.

Thanks in advance

It is implementing a 2 I retain two cache to achieve it Why is it necessary? Level class cache, so you have a first level cache in memory. This cache is faster than a disk cache (file cache), but its that There may not be too many elements on the second level cache, the file cache is a big but slow. So when she wants an image, first try to get it from the level cache, if she can not get there, then try on the second level cache. If the image is not, download it from the URL once the image is received from the internet, it is first stored in the level cache. If there is more image on the cache compared to the cache size, then at least the recently used image is taken from the first level cache to the other level.

Using 2 level cache reduces the use of internet connections, storage you used recently for those images.

Why do they need to mapping the view and image URL of the image?

The way the cache knows, the request is already looking at the map for the URL on the cache. Think of this as an image ID.


Comments