BitmapFactory.decodeResource() not getting right dpi

142 Views Asked by At

I'm using BitmapFactory.decodeResource() to get a bitmap from a drawable but i'm always getting the mdpi size of it. my drawable sizes are:

mdpi - 200x400

hdpi - 400x600

xhdpi - 600 x 800

xxhdpi - 800 x 1200

I'm using a 10" tablet and after logging the size of the bitmap the result i'm getting is 200x400. Am i doing something wrong? thanks in advance

Edit

Here's my code

private void setBitmap(Bitmap bitmap){
    Log.d(TAG, bitmap.getWidth() + " " + bitmap.getHeight());
    drawPad.setBackgroundBitmap(bitmap);
    drawPad.clear();
    if (bottomSheetLayout.isSheetShowing())
        bottomSheetLayout.dismissSheet();
}

and i'm calling this

setBitmap(BitmapFactory.decodeResource(getResources(), R.drawable.something));

0

There are 0 best solutions below