Problem about image cache on Android -


As a lot of people do, I want to cache the download cache to create image cache, map and soft reference I use.

In my implementation, the latest used bitmap will be placed on the first element of the map, so when the image cache comes in maximum cache size, the last element of the map that has not been used for a long time It can be removed, and the soft reference ensures that the bitmap will be recycled.

Here's the problem: How can I be sure that the deleted bitmap is not being used (i.e., dragging on the screen etc.) when it is recycled if bitmap is being used If so, will this be a soft-reference GC? It is really difficult to understand what "Reachability" means.

Thanks in advance!

If this is used by someone other than your cache soft reference, then it is definitely Is used with a hard reference (i.e. any variable or class member), then GC will not recycle it.


Comments