gpt4 book ai didi

android - Volley NetworkImageView 清除缓存图片

转载 作者:塔克拉玛干 更新时间:2023-11-02 09:05:15 26 4
gpt4 key购买 nike

有人知道是否可以使用 Google 的 Volley 库从单个 NetworkImageView 中清除缓存的图像吗?

我在 NetworkImageView 中有一张头像图片,我想在将其上传到服务器后显示新图片。目前如果我这样做 profileImg.setImageUrl("myUrl", mImageLoader); 我得到了缓存的图像。

最佳答案

检查一下:

1) 关闭缓存: 如果你想禁用特定 url 的缓存,你可以使用如下的 setShouldCache() 方法。

StringRequest stringReq = new StringRequest(....);
stringReq.setShouldCache(false);

2) 删除特定 URL 的缓存 : 使用 remove() 删除 URL 的缓存。

yourRequestQueue.getCache().remove(url);

3) 删除所有缓存 :

yourRequestQueue.getCache().clear(url);

此外,请查看此链接 here .

希望这对您有所帮助。

关于android - Volley NetworkImageView 清除缓存图片,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25287161/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com