gpt4 book ai didi

android - picasso :从磁盘加载缓存图像太慢

转载 作者:行者123 更新时间:2023-11-29 00:12:44 25 4
gpt4 key购买 nike

所以,我开始了我的项目并希望在我的项目中使用 Picasso,因为它很受欢迎并且被许多项目使用。我使用 gradle 包含了 picasso,并尝试用它加载 facebook 配置文件 url。 http://graph.facebook.com/rohitiskul/picture .

效果很好。它从网络加载图像没有任何问题。我重新启动了应用程序。(实际上没有终止进程)。它向我展示了立即缓存在内存中的相同图像。但是后来,我杀死了应用程序(强制停止)并重新启动。加载图像花费了将近 10 多秒。当我检查调试日志时,该图像正在从磁盘加载。

我的代码是这样的——在 MainActivity-

Picasso.with(context)
.load("http://graph.facebook.com/rohitiskul/picture")
.into(imageView);

在应用类中-

Picasso picasso = new Picasso.Builder(this)
.indicatorsEnabled(true).loggingEnabled(true).build()

Picasso.setSingletonInstance(picasso);

有遇到类似问题的吗?任何解决方案都会有所帮助。

我尝试使用 UniversalImageLoader 加载相同的 Url,从磁盘获取缓存图像时速度很快。

编辑

之前在玩我的应用时,我发现 Picasso 在设备离线时没有加载磁盘缓存图像。

最佳答案

我遇到了同样的问题,但发现第一张图片速度较慢,后面的图片会很快。

可能需要预热(加载索引缓存)?

关于android - picasso :从磁盘加载缓存图像太慢,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29037056/

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