我的位图出现内存不足的问题。这是代码:
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());
一切都很好,但是当我改变方向时,我会失去记忆。我该如何解决我的问题?我正在考虑软引用,但我不知道如何将它用于位图。任何想法?