Android 安卓毕加索图像下载
我有一个活动,其中有一个带有一些图像的对话框窗口。我想在活动开始时将这些图像下载到缓存中,并在出现对话框窗口时从缓存中加载它们 我的活动代码:Android 安卓毕加索图像下载,android,caching,picasso,Android,Caching,Picasso,我有一个活动,其中有一个带有一些图像的对话框窗口。我想在活动开始时将这些图像下载到缓存中,并在出现对话框窗口时从缓存中加载它们 我的活动代码: for(int i=0; i<avataritemlist.size();i++){ Picasso.with(activity_context) .load(item.getpath()) .noFade();
for(int i=0; i<avataritemlist.size();i++){
Picasso.with(activity_context)
.load(item.getpath())
.noFade();
}
我希望在activty中缓存映像,然后在dialog adapter中从缓存加载,但在我的情况下,它会在adapter中再次下载映像。我想强调的是,
activity\u context
和mContext
是相同的。我做错了什么?返回的默认毕加索实例使用自动内存和磁盘缓存。它使用默认值初始化:
• LRU memory cache of 15% the available application RAM
• Disk cache of 2% storage space up to 50MB but no less than 5MB. (Note: this is only available on API 14+ or if you are using a standalone library that provides a disk cache on all API levels like OkHttp)
• Three download threads for disk and network access.
默认毕加索实例的LRU内存缓存是什么,您可能不知道,您所知道的只是它是一个使用最近最少使用的逐出策略的内存缓存
但是,您可以使用创建毕加索实例,从而更好地控制图像缓存(通过磁盘)。有关如何使用max age和too设置http请求头属性缓存控制的更多信息,请查看
此外,您可能还想尝试一下哪个语法与毕加索非常相似,默认毕加索实例使用自动内存和磁盘缓存返回。它使用默认值初始化:
• LRU memory cache of 15% the available application RAM
• Disk cache of 2% storage space up to 50MB but no less than 5MB. (Note: this is only available on API 14+ or if you are using a standalone library that provides a disk cache on all API levels like OkHttp)
• Three download threads for disk and network access.
默认毕加索实例的LRU内存缓存是什么,您可能不知道,您所知道的只是它是一个使用最近最少使用的逐出策略的内存缓存
但是,您可以使用创建毕加索实例,从而更好地控制图像缓存(通过磁盘)。有关如何使用max age和too设置http请求头属性缓存控制的更多信息,请查看
此外,您可能还想尝试一下在语法上与毕加索非常相似的方法使用ImageLoader,这将有助于维护缓存并从缓存中加载图像,有关更多信息,请参阅:
但它是用于凌空库,我正在使用Picasso抱歉我发布一个链接的错误…我也在cachin图像上添加了一个链接…使用ImageLoader将有助于维护缓存并从缓存中加载图像以获取更多信息请参考:
但这是用于凌空库,我正在使用Picasso抱歉我发布一个链接的错误…我也在cachin图像上添加了一个链接。。。