Android image caching framework of image talking series,
I have read many wonderful articles, but I always think that text descriptions are not as intuitive as pictures or chart descriptions, because they can be abstracted as concrete. The language is regional, while the image is universal all over the world. Even if the language is not available, you can understand everything through the image. Therefore, if you want to create a series of simple blogs, the content is a picture with some necessary instructions, so that you can quickly grasp the key points and understand the framework without having to read too much. Some of the images involved in the article may come from official websites, from famous blogs, or from self-drawn ones.
Let's get started with the first round ,:
From: https://github.com/nostra13/Android-Universal-Image-Loader
This is the Image processing flowchart of the famous open-source library Android-Universal-Image-Loader.
Brief description:
1. Image cache is divided into two parts: memory cache and disk cache.
2. When the image is displayed, the image is read from the memory cache. If the image is found in the memory cache, the image is displayed directly.
3. If the memory cache does not exist, search in the disk cache. If it is found, encode it as Bitmap. Then, pre-process the image, cache it To the memory, and display the image.
4. if no image is found in both the memory cache and the disk cache, download the image, cache it to the disk, encode it as Bitmap, and pre-process the image, then cache the image to the memory and display the image.
There are many Android image cache frameworks and their principles are similar. They are basically the above logic. You can write your own image cache framework based on the above process.