[英]Cache images with picasso + okhttp
I'm using picasso + okhttp to load and cache images. 我正在使用picasso + okhttp加载和缓存图像。
Currently this code is working as I expect and the cache is working as I want it to. 目前,此代码可以按我预期的方式运行,而缓存按预期运行。
Picasso.with(Context).load("http://images.com/image.png").into(ImageView);
I want to download images on a initial synchronization, so I tried this code: 我想在初始同步时下载图像,因此尝试了以下代码:
Picasso.with(Context).load("http://images.com/image.png");
But it is not working. 但这是行不通的。 The request (from the okhttp lib) is made in the function into(ImageView) .
该请求(来自okhttp库)是通过函数into(ImageView)发出的。
How can I cache the image to use it later with Picasso or okhttp? 我如何缓存图像以便以后在Picasso或okhttp中使用?
Thanks 谢谢
仅供以后参考,我通过以下方法解决了该问题:
Picasso.with(Context).load("http://images.com/image.png").fetch();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.