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

相關文章
相關標籤/搜索