2
我想从缓存中获取图像,我正在使用排球库并成功显示图像。我想从缓存中获取相同的下载图像
下面是我的代码。
如何从缓存中使用Volley Library获取图像位图
Cache cache = AppController.getInstance().getRequestQueue().getCache();
Entry entry = cache.get(ImageUrl);
if (entry != null) {
try {
// Get Data From Catch Successefully
String data = new String(entry.data, "UTF-8");
// but now this code return null value i want Bitmap From Catch
LruBitmapCache bitmapCache = new LruBitmapCache();
mBitmap = bitmapCache.getBitmap(data);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
我可以从缓存中的数据,但bitmapCache.getBitmap(数据);返回的null。
http://www.androidhive.info/2014/05/android-working-with-volley-library-1/ – 2014-10-22 06:33:39
检查:http://stackoverflow.com/questions/19396852/volley-image-caching – 2014-10-22 06:33:43
我认为你必须使用Android查询,而不是Volley,它提供缓存功能就像简单的启用真正的缓存falg从这里获取更多的信息:http:/ /code.google.com/p/android-query/ – 2014-10-22 06:51:44