System.gc () does not help you and does not guarantee anything.
If you are absolutely sure that the output raster images are no longer needed and there is no link to them anywhere (the exception βUnable to draw the processed raster imageβ will catch the exception), I would suggest you add EvictionListener to your LRU cache and call bitmap.recycle () for each the displayed value.
It is impossible to remember if, by default, the LRU cache provides convenient methods for installing an eviction listener, but if not, it is very simple to expand it and add the necessary functions.
PS I would advise WeakReferences, as you lose control of your bitmaps and the LRU target. Even if you download 8 bitmaps that fit well in 1/8 of the memory, but only 4 of them can be displayed on the screen at a time (ImageViews contains strong links to bitmaps) gc will clear the remaining 4 as soon as possible. And I really mean ultra fast. You will have to reload the bitmap for each new row (in the case of ListView) that you display. And every bitmap that appears on the screen should be reloaded again.
source share