Android: Picasso load image failed . how to show error message

后端 未结 6 588
后悔当初
后悔当初 2020-11-29 02:37

I am trying to use the picasso library to loading the image store in the mediastore. When I called load(imageview, callback), the picasso call onFail instead of onSuccess. H

6条回答
  •  星月不相逢
    2020-11-29 03:29

    When you use callback, the picaso will call method onSuccess and onError!

    File fileImage = new File(mPathImage);
            Picasso.with(mContext).load(fileImage)
                    .placeholder(R.drawable.draw_detailed_view_display)
                    .error(R.drawable.draw_detailed_view_display)
                    .resize(200, 200)
                    .into(holder.mImageEvidence, new Callback() {
                        @Override
                        public void onSuccess() {
                            holder.mMediaEvidencePb.setVisibility(View.GONE);
                        }
    
                        @Override
                        public void onError() {
                            holder.mErrorImage.setVisibility(View.VISIBLE);
                        }
                    });
    

提交回复
热议问题