【问题标题】:Cache images with picasso + okhttp使用 picasso + okhttp 缓存图片
【发布时间】:2014-09-23 06:00:17
【问题描述】:

我正在使用 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 一起使用?

谢谢

【问题讨论】:

    标签: android image caching picasso okhttp


    【解决方案1】:

    仅供参考,我解决了这个问题:

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

    【讨论】:

      猜你喜欢
      • 2015-11-25
      • 2014-06-13
      • 2016-09-03
      • 2015-11-15
      • 2021-04-30
      • 2015-01-02
      • 2015-05-23
      • 1970-01-01
      • 2019-04-11
      相关资源
      最近更新 更多