Explain the three-level cache and examples of pictures in Android

Explain the three-level cache and examples of pictures in Android

Why use L3 cache

What is L3 cache

Principle of L3 cache

Specific implementation and code

1. Custom image caching tool class (mybitmaputils)

Provide an interface for external methods to cache pictures through new mybitmaputils(). Display (ImageView ivpic, string URL)

Parameter meaning: ivpic is used to display the ImageView URL of the picture and obtain the network address of the picture

2. Network cache (netcacheutils)

3. Local cache utils

4. Memory cacheutils

Monochrome map: 1 / 8 bytes per pixel, 16 color map: 1 / 2 bytes per pixel, 256 color map: 1 byte per pixel, 24 bitmap: 3 bytes per pixel (common RGB pictures)

For example, a 1920x1080 JPG image is parsed in ARGB format in Android system, that is, a pixel needs to occupy 4 bytes, and the size of the image = 1920x1080x4 = 7m

Implementation method:

If you have any questions, please leave a message or go to the community of this site for exchange and discussion. Thank you for reading. I hope it can help you. Thank you for your support to this site!

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>