When you get a bitmap from a resource for example with:
Bitmap src = BitmapFactory.decodeResource(getResources(), R.drawable.yourimage);
It is automatically scaled depending on the device’s screen density. How can I avoid that and retrieve it in its original pixel size whatever the screen density is?
Thanks
What do you mean “It is automatically scaled”? When you call this method Android takes image from folder
res/drawable-?dpi– depending on device where app is running. If yourldpifolder contains 30*30px image,mdpicontains 40*40px image andhdpicontains 60*60px, you will get bitmap one of this sizes(depends on device). Android does not change anything.If you see that on the screen your image scaled somehow, check properties of
ImageView.