Glide 4.0.0 下之加载本地缓存的图片

2022-11-23,,,,

在网上搜了下,无意中发现RequestOptions还有个方法: onlyRetrieveFromCache

用了下是OK的

        try {
File imageFile = Glide.with(context).asFile()
.apply(RequestOptions.priorityOf(Priority.HIGH).onlyRetrieveFromCache(true))
.load(image.getFullUrl())
.submit().get();
if(imageFile != null && imageFile.exists()){ if(IConfig.DEBUG) Log.d("XXX", "found the file:" + imageFile.getAbsolutePath()); }
}catch (Exception e){
e.printStackTrace();
}

这下可以在项目中使用了

Glide 4.0.0 下之加载本地缓存图片的相关教程结束。

《Glide 4.0.0 下之加载本地缓存的图片.doc》

下载本文的Word格式文档,以方便收藏与打印。