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

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

用了下是OK的ide

        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();
        }

这下能够在项目中使用了spa

相关文章
相关标签/搜索