有没有办法让毕加索排队下载的进展如何? [英] Is there a way get the progress of the queued downloads in Picasso?

查看:242
本文介绍了有没有办法让毕加索排队下载的进展如何?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发一个应用程序,它应该能够pre下载从数据集内使用,这样应用程序可以完全离线功能的所有图像。

I'm developing an app which should be able to pre-download all images used from within the dataset so that the app can function fully offline.

应该下载每个500KB的 600的图像(〜300 MB计)。

It should download about 600 images of each 500KB (~300 MB in total).

对于这个我想通过所有的URL要循环并执行毕加索取()方式。这将获取所有图像,这是伟大的。

For this I'd want to loop through all url's and execute Picasso fetch() method. This will fetch all images, which is great.

我唯一缺少的是一种方法,看看在进度是所有的图像下载。有没有办法看到下载队列毕加索的进展如何?这样我可以通知用户,当下载完成,并告知当前的状态是什么。

The only thing I'm missing is a way to see what the progress is of all the image downloads. Is there any way to see the progress of the download queue of Picasso? This way I can notify the user when the downloads are done, and inform what the current status is.

我已经发现迄今:


  • 我可以使用一个目标的图像加载到。只有这也将去code到一个位图,这是没有必需的,需要太多的资源。

  • 我能以某种方式读取缓存文件夹,检查进度。但我认为这不是一个干净的方式...

推荐答案

首先,你不应该preLOAD的所有图像。
如果您使用的是毕加索或通用图像装载机比两者都被缓存图像。这样一来你肯定(或几乎)约OutOfMemoryException异常。

First of all, you should not preload all images. If you are using Picasso or Universal Image Loader than both of them are caching your images. In that way you are sure (or almost) about OutOfMemoryException.

但如果你真的想这样做,检查通用图像装载机的LoadImage(字符串URI,ImageLoadingListener听众)

But if you really want to do this, check Universal Image Loader loadImage(String uri, ImageLoadingListener listener)

https://github.com/nostra13/Android-Universal-Image-Loader

imageLoader.loadImage(imageUri, new SimpleImageLoadingListener() {
    @Override
    public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
       // Do whatever you want with Bitmap
     }
});

这篇关于有没有办法让毕加索排队下载的进展如何?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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