I am reading an image from disk and displaying it inside of a row in a ListView
. The image files are larger than what needs to be displayed inside the ImageView
of the rows. Since I need to cache the bitmaps
in RAM for faster access I would like them to only be as large as the ImageView
s (85x85 dip)
Right now I am reading in the file with
bitmap = BitmapFactory.decodeFile(file);
and the ImageView is responsible for scaling and cropping it
android:scaleType="centerCrop"
AFAIK this is keeping the entire bitmap in memory (because I cached it XD) and that is bad
How can I remove this responsibility from the ImageView and do the crop + scale while loading the file? All the bitmaps will be displayed at 85x85 dip and need to be 'centerCrop'