Android picasso multi-thread
Asked Answered
G

1

5

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?

Gladysglagolitic answered 18/2, 2014 at 18:46 Comment(1)
Thanks for this question!Smithers
T
8

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/.

Tesler answered 18/2, 2014 at 18:57 Comment(3)
Link is down. You should have pasted some bits that were meaningful to this question.Plaque
The new documentation is here: square.github.io/picasso/2.x/picasso. @HenriquedeSousa I believe my answer was apt for the question asked and I also explained how to use executor with Picasso, which was not even asked. A bit of search for documentation would have brought anyone to see how to use Picasso.Builder in new library. Even the new link can be removed in future so better is to understand the concept instead of finding the right link.Tesler
Quoting the FAQ:Provide context for links: Links to external resources are encouraged, but please add context around the link so your fellow users will have some idea what it is and why it’s there. Always quote the most relevant part of an important link, in case the target site is unreachable or goes permanently offline.Plaque

© 2022 - 2024 — McMap. All rights reserved.