I want to scale down a 500x500px resource to fit always a specific size which is determined by the width of the screen.
Currently I use the code from the Android Developers Site (Loading Large Bitmaps Efficiently), but the quality is not as good as I would use the 500x500px resource in a ImageView
(as source in xml) and just scale the ImageView
and not the Bitmap.
But it's slow and I want to scale the Bitmap
, too, to be memory efficient and fast.
Edit: The drawable which I wanna scale is in the drawable
folder of my app.
Edit2: My current approaches.
The left image is the method from Loading Large Bitmaps Efficiently without any modifications. The center image is done with the method provided by @Salman Zaidi with this little modification: o.inPreferredConfig = Config.ARGB_8888;
and o2.inPreferredConfig = Config.ARGB_8888;
The right image is an imageview where the image source is defined in xml and the quality I wanna reach with a scaled bitmap.