AbdelHady AbdelHady - 1 year ago 219
Android Question

Use a thumbnail as a placeholder for Picasso

From the UX point of view, it will be great to show the user a thumbnail first until the real image completes loading, then showing it to him, but Picasso uses only a resource file as the place holder like:


So, how can I use a thumbnail URL as the placeholder? , and if I should use Picasso twice, then how?

An issue is already opened on Picasso's github page with this request, but seems it won't be added to Picasso as per JakeWharton. So how could we do it with what's available in hand?

Answer Source

Thanks to raveN here & the comments on the original request on github, finally I've got a working solution:

       .load(thumb) // thumbnail url goes here
       .into(imageView, new Callback() {
            public void onSuccess() {
                        .load(url) // image url goes here
            public void onError() {


The trick here is to get the drawable from the imageView (which is the thumbnail) after the first call & pass it as a placeholder to the second call

-- update --

I've made a blog post describing the whole scenario

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download