Android 毕加索缓存图像 [英] Android picasso cache images

查看:30
本文介绍了Android 毕加索缓存图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在书面文档中,毕加索缓存下载的图像,但我还没有看到如何从缓存中再次调用该图像的示例.

In documentation in written that picasso caches images downloaded , but i havent seen an example how to call that image again from cache.

这里是我第一次加载图像:

Here i first time load the image :

Picasso.with(getActivity())
        .load(thirdArticle.getImageURL())
        .resize(200, 150)
        .centerCrop()
        .into(mainThreeArticleImage);

当我第二次调用上面的相同代码时,它不应该从缓存中获取???

Second time when i call same code above it shouldnt get from cache ???

如果没有,如何通过该 url 调用缓存的图像??

If not, how to call cached images by that url ??

推荐答案

Picasso 自动缓存加载的图像,以便下次从缓存中加载它们.您可以通过启用指示器来检查图像是从网络、缓存还是磁盘加载的

Picasso automatically caches the loaded images, So that next time they will be loaded from the cache. You can check whether the image is loaded from the web, cache or disk by enabling the indicator

setIndicatorsEnabled(true)

将为每个图像显示指示符,指定图像的加载位置.
我从这里

Indicators will be shown for each image, specifying where the image is loaded from.
I got the reference from here

这篇关于Android 毕加索缓存图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆