0
從SoftReference的retrive位圖,我把我的位圖到HashMap中爲:無法在Android的
HashMap<String, SoftReference<Bitmap>> imageMap = new HashMap<String, SoftReference<Bitmap>>();
....
bitmap = BitmapFactory.decodeStream(inputstream);
imageMap.put(String.valueOf(i), new SoftReference<Bitmap>(bitmap));
而且我每次遞增它,我也得到位。
我retrive位圖由:
SoftReference<Bitmap> setValue = imageMap.get(String.valueOf(count));
Bitmap bitmap=setValue.get();
我遞增。但我得到的位圖特定計數我們only.How可以從HashMap的每一個位圖計數每一次?
解碼需要很長時間。這就是爲什麼我在解碼器本身解碼所有圖像的原因。我能做些什麼來避免這種時間延遲? – 2013-03-01 07:07:51
它實際上取決於您使用圖像的方式。你有沒有檢查http://developer.android.com/training/displaying-bitmaps/cache-bitmap.html?這種方式可能更適用,因爲SoftReference可能被清除得太快。 – sandrstar 2013-03-01 07:16:58