佔位符和錯誤處理

Picasso 支援下載和錯誤佔位符作為可選功能。它還提供了處理下載結果的回撥。

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() {}
   });

在顯示錯誤佔位符之前,將重試請求三次。