Downloading image as Bitmap using Picasso

suggest change

To download an image as a Bitmap with Picasso:

Picasso.with(mContext)
        .load(ImageUrl)
        .into(new Target() {
            @Override
            public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {
               // Todo: Do something with your bitmap here
            }

            @Override
            public void onBitmapFailed(Drawable errorDrawable) {
            }

            @Override
            public void onPrepareLoad(Drawable placeHolderDrawable) {
            }
        });

Keep a strong reference to the Target. Picasso holds it only weakly, so an anonymous instance can be collected before onBitmapLoaded runs.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents