gpt4 book ai didi

android - 使用 picasso + okhttp 缓存图像

转载 作者:行者123 更新时间:2023-11-29 15:15:09 32 4
gpt4 key购买 nike

我正在使用 picasso + okhttp 来加载和缓存图像。

目前这段代码正在按我预期的方式工作,缓存也在按我希望的方式工作。

Picasso.with(Context).load("http://images.com/image.png").into(ImageView);

我想在初始同步时下载图片,所以我尝试了这段代码:

Picasso.with(Context).load("http://images.com/image.png");

但它不起作用。请求(来自 okhttp 库)是在函数 into(ImageView) 中发出的.

我如何缓存图像以便稍后在 Picasso 或 okhttp 中使用它?

谢谢

最佳答案

为了将来引用,我解决了这个问题:

Picasso.with(Context).load("http://images.com/image.png").fetch();

关于android - 使用 picasso + okhttp 缓存图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25056394/

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