用Map集合缓存软引用的Bitmap对象
Map<String, SoftReference<Bitmap>> imageCache = new new HashMap<String, SoftReference<Bitmap>>();
//强引用的Bitmap对象Bitmap bitmap = BitmapFactory.decodeStream(InputStream);//软引用的Bitmap对象SoftReference<Bitmap> bitmapcache = new SoftReference<Bitmap>(bitmap);//添加该对象到Map中使其缓存imageCache.put("1",softRbitmap);... //从缓存中取软引用的Bitmap对象SoftReference<Bitmap> bitmapcache_ = imageCache.get("1");//取出Bitmap对象,如果由于内存不足Bitmap被回收,将取得空Bitmap bitmap_ = bitmapcache_.get();