美文网首页
Glide用法记录(更新中。。)

Glide用法记录(更新中。。)

作者: Gear_033e | 来源:发表于2017-11-27 15:53 被阅读8次

1.从网络中读取图片保存到缓存中

 private String getImagePath(String imgUrl) {
        String path = null;
        FutureTarget<File> future = Glide.with(ViewBigImageActivity.this)
                .load(imgUrl)
                .downloadOnly(500, 500);
        try {
            File cacheFile = future.get();
            path = cacheFile.getAbsolutePath();
        } catch (InterruptedException | ExecutionException e) {
            e.printStackTrace();
        }
        return path; //返回缓存图片路径
    }

相关文章

网友评论

      本文标题:Glide用法记录(更新中。。)

      本文链接:https://www.haomeiwen.com/subject/tsjdbxtx.html