Jawegiel Jawegiel - 16 days ago 7
Android Question

Another bitmap's sizes

I added bitmap image to drawable folder with 64x64 sizes. Then I get a reference to this by

Bitmap b = BitmapFactory.decodeResource(getResources(), R.drawable.brick);
The problem is in output I get an image with 128x128 sizes. I dont use any
BitmapFactory.Options
. Why it happens?

Answer

I added bitmap image to drawable folder with 64x64 sizes

I am going to assume that you mean this literally, and you put the images in res/drawable/. That is a synonym for res/drawable-mdpi/.

The problem is in output I get an image with 128x128 sizes.

That would occur if your device is an -xhdpi device. Android will resample the drawable from -mdpi (~160dpi) to -xhdpi (~320dpi).

Try moving your image to res/drawable-nodpi/.