androidbitmapdrawable

change bitmap size based device Android Studio


In android studio the return value of this function BitmapFactory.decodeResource(getResources(), R.drawable.basictiles) changes based on device size.

as and example

Pixel:

SM-G900F

I'm trying to find a way to get the same image size for every device/resolution.


Solution

  • put your R.drawable.basictiles file inside drawable-nodpi folder

    another approach is to use new BitmapFactory.Options() when decodeResource (third param) and set inScaled param to false