简体   繁体   English

清除BitMap缓存 - koush ion

[英]Clear BitMap Cache - koush ion

i would like to clear bitmap cache but i am not sure how to clear the bit map . 我想清除位图缓存,但我不知道如何清除位图。 I am using Koush Ion library to load the picture 我正在使用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();
        }

i need to clear the bitmap cache everytime i click on a button. 我需要在每次单击按钮时清除位图缓存。 Thanks in advance 提前致谢

Use Ion.getDefault(context).getCache().clear() to clear the file cache. 使用Ion.getDefault(context).getCache().clear()清除文件缓存。

Use Ion.getDefault(context).getBitmapCache().clear() to clear the in-memory bitmap cache. 使用Ion.getDefault(context).getBitmapCache().clear()清除内存中的位图缓存。

See the source for the respective methods at: 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 请参阅相应方法的来源: https//github.com/koush/AndroidAsync/blob/master/AndroidAsync/src/com/koushikdutta/async/util/FileCache.java#L292 https://github.com/ koush /离子/斑点/主/离子/ SRC / COM / koushikdutta /离子/位图/ IonBitmapCache.java#L63

Ion.dump() will NOT clear the cache. Ion.dump()不会清除缓存。 It will simply print some debug information to the log. 它只是将一些调试信息打印到日志中。 You can look up the source code for it, too. 您也可以查找它的源代码。

try this may help,,i used this code for clearing my network data cache; 试试这可能有帮助,我使用此代码清除我的网络数据缓存;

Ion.getDefault(context).configure().getResponseCache().clear() Ion.getDefault(上下文).configure()。getResponseCache()。明确的()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM