Search code examples
androidimageviewpicasso

Android Picasso How to perform action when placeholder transition into image


I am using Picasso in my application to load image from a url into an image view. I would like to perform an action, but only once the image has arrived and not when the loading placeholder is visible.

How do I achieve this ?

Thanks!


Solution

  • you can use picasso's callback as below

    Picasso.with(getContext())
        .load(url)
        .into(imageView, new com.squareup.picasso.Callback() {
                            @Override
                            public void onSuccess() {
                                  // do something if its loaded successfully
                            }
    
                            @Override
                            public void onError() {
                                 // do something if its not loaded successfully
                            }
                        });