我的位图内存不足有问题。这是代码:
Uri bitmapPictureUri = intent.getParcelableExtra(TaskActivity.PHOTO);
Bitmap bitmap = null;
try {
bitmap = MediaStore.Images.Media.getBitmap(this.getContentResolver(), bitmapPictureUri);
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
int nh = (int) (bitmap.getHeight() * (512.0 / bitmap.getWidth()));
bitmapPicture = Bitmap.createScaledBitmap(bitmap, 512, nh, true);
picture.setImageBitmap(bitmapPicture);
fileName.setText(tNameText+"_"+getCurrentTime());
一切都还可以,但是当我改变方向时,我会退出.OmMemory。我怎样才能解决我的问题?我正在考虑软参考,但我不知道如何使用它来进行位图。有什么想法吗?