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