[問題] 關於Bitmap recycle
想請 我用android 1.6 寫了一個有要輸出圖片的程式如下:
public void loadBitmap(){
Bitmap rawPhoto = null;
if(photoByte != null){
rawPhoto = BitmapFactory.decodeByteArray(photoByte, 0, photoByte.length);
}
....
entry.photo = mPhoto = Bitmap.createBitmap(rawPhoto);
rawPhoto.recycle();
....
}
public View getView(int position, View convertView, ViewGroup parent){
.....
views.photo.setImageBitmap(entry.photo);
....
}
結果 entry.photo 發生了
trying to use a recycled bitmap android.graphics.Bitmap
的exception
想請問 rawPhoto 被 recycle ,會影響到entry.photo的使用嗎?
因為程式看來看去只有那地方有寫recycle....系統應該不會主動回收吧??
謝謝
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 114.42.235.198
※ 編輯: dreamvic 來自: 114.42.235.198 (05/09 21:30)
推
05/09 21:33, , 1F
05/09 21:33, 1F
推
05/09 21:33, , 2F
05/09 21:33, 2F
※ 編輯: dreamvic 來自: 114.42.235.198 (05/09 21:37)
※ 編輯: dreamvic 來自: 114.42.235.198 (05/09 21:38)
討論串 (同標題文章)
以下文章回應了本文:
完整討論串 (本文為第 1 之 2 篇):