0

このエラーの解決に成功しませんでした:

java.lang.OutOfMemoryError:ビットマップサイズがVMバジェットを超えています。

私のコードは次のとおりです。

BitmapFactory.Options op = new BitmapFactory.Options();
myBitmap = BitmapFactory.decodeFile(file.getAbsolutePath(),op);
ImageView _image = (ImageView)view.findViewById(R.id.imageCarte);

int width = myBitmap.getWidth();
int height = myBitmap.getHeight();
int halfWidth = width/2;
int halfHeight = height/2;
Bitmap bmHalf = Bitmap.createScaledBitmap(myBitmap, halfWidth, halfHeight, false);
_image.setImageBitmap(bmHalf);
4

2 に答える 2

0

これは、Android でビットマップを処理するために必読です。

于 2012-05-06T10:58:26.153 に答える