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.
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
You may want to look at:
BitmapFactory.decodeResource(Resources res, int id, BitmapFactory.Options opts)
You can find it here
Essentially you need to pass in BitmapFactory.Options which can be used to control the resulting scaling, width, height etc of the Bitmap
BitmapFactory.Options options = new BitmapFactory.Options();
options.outHeight = ;// the height you want
options.outWidth = ;// the width you want
BitmapFactory.decodeResource(getResources(), R.drawable.basictiles, options);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With