Android Picasso多线程 [英] Android picasso multi-thread

查看:73
本文介绍了Android Picasso多线程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我查看了 Picasso 的文档,却看不到有关线程的任何信息.如果我运行以下命令(对于ListView),会发生什么情况:

I looked over the documentation of Picasso and couldn't see anything about threading. What will happen if I run something like this (for ListView):

for(String url : urlArray)
{
    Picasso.with(context).load(url).into(Holder.imageView);
}

图像会并行加载还是一一加载?

would the images load parallely or one by one?

推荐答案

Picasso使用线程池执行程序在后台加载图像.下载完成后,它将使用UI线程加载图像.如果要与应用程序中已使用的线程池执行程序共享,还可以将其配置为使用您提供的线程池执行程序.请参阅Picasso.Builder的文档,该文档具有执行者参数 https://square. github.io/picasso/2.x/picasso/.

Picasso uses a thread pool executor for loading images in background. Once downloading is complete it loads the image using UI thread. You can also configure it to use thread pool executor supplied by you, if you want to share it with the one already used in the app. See the documentation of Picasso.Builder which has a parameter for executor, https://square.github.io/picasso/2.x/picasso/.

这篇关于Android Picasso多线程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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