Picasso image load callback

后端 未结 5 442
不思量自难忘°
不思量自难忘° 2020-12-08 13:20

I want to use Picasso to load three consecutive images one on top of each other in a listview. Using the methods Picasso provides makes this easy. However because these imag

5条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-08 14:04

    This is loading a image url into an imageview with simple picasso callbacks

               Picasso.with(this)
                .load(Picurl)
                .into(Imageview, new Callback() {
                            @Override
                            public void onSuccess() {
    
                            }
    
                            @Override
                            public void onError() {
    
    
                            }
                        }
                );
    

    And this is picasso image loading with more callbacks

    private void loadImage() {
        Picasso.with(this)
                .load(PicURL)
                .into(mContentTarget);
      }
    
    
    private Target mContentTarget = new Target() {
        @Override
        public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {
        Imageview.setImageBitmap(bitmap);
        }
    
        @Override
        public void onBitmapFailed(Drawable errorDrawable) {
        }
    
        @Override
        public void onPrepareLoad(Drawable placeHolderDrawable) {
        }
    };
    

提交回复
热议问题