I have a png image of 280 × 558 pixels. But when I load it with
BitmapFactory.decodeResource(getResources, R.drawable.image_name)
the created Bitmap size is 186 × 371.
That happens with the Nexus 7 using the images in the drawable-large-xhdpi folder. The ldpi and mdpi devices load their respective images in drawable-ldpi and drawable-mdpi correctly.
Why is this happening?
Nexus 7 is not xhdpi, it's scaling images from hdpi to tvdpi
Google Nexus 7 | 4.1 | tvdpi (but will scale down your hdpi assets
See: http://blog.blundellapps.com/list-of-android-devices-with-pixel-density-buckets/
To load image without scaling, use the inScaled option of BitmapFactory.Options. Using these options, you can also scale to different dpi.
See: http://developer.android.com/reference/android/graphics/BitmapFactory.Options.html#inScaled