Android Bitmap OOM处理

    public int calculateInSampleSize(BitmapFactory.Options option, int rWidth, int rHeight) {

        final int width = option.outWidth;

        final int height = option.outHeight;

        option.inSampleSize = 1;

 

        while ((height / option.inSampleSize) > rHeight || (width / option.inSampleSize) > rWidth) {

            option.inSampleSize *= 2;

        }

        return option.inSampleSize;

    }

posted on   行殇  阅读(167)  评论(0编辑  收藏  举报

努力加载评论中...

导航

点击右上角即可分享
微信分享提示