15

ビットマップの幅と高さを取得する必要がありますが、これを使用するとメモリ不足の例外が発生します。

    Resources res=getResources();
    Bitmap mBitmap = BitmapFactory.decodeResource(res, R.drawable.pic); 
    BitmapDrawable bDrawable = new BitmapDrawable(res, mBitmap);

    //get the size of the image and  the screen
    int bitmapWidth = bDrawable.getIntrinsicWidth();
    int bitmapHeight = bDrawable.getIntrinsicHeight();

Get bitmap width and height without loading to memory but what would be the inputStream here?という質問の解決策を読みました。

4

2 に答える 2