Android Picasso Placeholder and Error Handling


Example

Picasso supports both download and error placeholders as optional features. Its also provides callbacks for handling the download result.

Picasso.with(context)
  .load("YOUR IMAGE URL HERE")
  .placeholder(Your Drawable Resource)   //this is optional the image to display while the url image is downloading
  .error(Your Drawable Resource)         //this is also optional if some error has occurred in downloading the image this image would be displayed
  .into(imageView, new Callback(){
     @Override
        public void onSuccess() {}

        @Override
        public void onError() {}
   });

A request will be retried three times before the error placeholder is shown.