갤러리에서 이미지를 가져오고 있습니다 (의도별로).비트 맵 메모리 부족
985120-byte external allocation too large for this process.
Out of memory: Heap Size=4871KB, Allocated=2472KB, Bitmap Size=19677KB
VM won't let us allocate 985120 bytes
나는 이미지를 얻을 어디에 내 코드입니다 :
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
....
mBitmap = Media.getBitmap(this.getContentResolver(), data.getData());
...
}
내가 그것을 어떻게 해결할 수
는이 오류가있어?
-------- UPDATE는 ---------
은 내가 (HTC 사진 설치) 사전에 존재하지 않는 이미지를 선택하면 나는이 오류가 나타났습니다. 카메라에서 선택한 이미지를 선택하면 모두 정상적으로 작동합니다.
BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
InputStream stream = getContentResolver().openInputStream(data.getData());
mBitmap = BitmapFactory.decodeStream(stream,null,options);
stream.close();
을하지만 지금은 비트 맵은 NULL입니다! :
그래서,이 http://developer.android.com/training/displaying-bitmaps/load-bitmap.html에 따라 코드를 변경
http://stackoverflow.com/questions/6118464/android-out-of-memory-error-bitmap-is-too-big?rq=1 – Ridcully
options.inJustDecodeBounds = 사실의 사용 가능한 복제; 이걸 사용하면 비트 맵의 크기 만 디코드하고 배부하지 않으므로 null입니다. options.inScale을 사용하여 비트 맵의 크기를 줄이십시오. –
http://stackoverflow.com/a/4665992/1615280 – bjorncs