I am currently building an Android application (a game). I have created ldpi, mdpi and hdpi of all of the images (the dimensions of all of these images have been appropriately calculated).
When I test the game on my Samsung S3, the value of the below code is 2.0.
getResources().getDisplayMetrics().density;
This is correct, and all images used in the application are automatically selected from the drawable-hdpi folder.
However, when I test the application on my Google Nexus One, the above code evaluates to 1.5 (correctly), and yet images from the drawable-hdpi folder are still automatically selected.
For reference, I am loading the bitmaps in this manner:
BitmapFactory.Options bmpFactoryOptions = new BitmapFactory.Options();
bmpFactoryOptions.inScaled = false;
Bitmap exampleBitmap = BitmapFactory.decodeResource(gamePanel.getResources(), R.drawable.example, bmpFactoryOptions);
EDIT: Removing the second line still does not fix the issue.
Am I doing something wrong? If so, what? Alternatively, is there a workaround?
Many thanks in advance.
The Samsung Galaxy SIII is an XHDPI device.
The Nexus One is a HDPI device.
Reference:
http://blog.blundellapps.com/list-of-android-devices-with-pixel-density-buckets/
Therefore, because you don’t have XHDPI resources, it uses the next closest for the SIII (hdpi).