清除位图缓存 - koush ion

4

我想清除位图缓存,但不确定如何清除位图。 我正在使用Koush Ion库加载图片。

try {
            bitmap = Ion.with(context).load(URLimage).withBitmap().asBitmap().get();
        } catch (InterruptedException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (ExecutionException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
每次我点击按钮时,我需要清除位图缓存。谢谢。
2个回答

阿里云服务器只需要99元/年,新老用户同享,点击查看详情
5
使用Ion.getDefault(context).getCache().clear()清除文件缓存。 使用Ion.getDefault(context).getBitmapCache().clear()清除内存中的位图缓存。 有关各自方法的源代码,请参见: https://github.com/koush/AndroidAsync/blob/master/AndroidAsync/src/com/koushikdutta/async/util/FileCache.java#L292 https://github.com/koush/ion/blob/master/ion/src/com/koushikdutta/ion/bitmap/IonBitmapCache.java#L63 Ion.dump()不会清除缓存。它只会将一些调试信息打印到日志中。您也可以查找其源代码。

1

尝试这个可能有帮助,我使用了这段代码来清除我的网络数据缓存;

Ion.getDefault(context).configure().getResponseCache().clear()


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,