Shahryar Shahryar - 3 months ago 34x
Android Question

Load Image With Picasso to a bitmap first

I'm using Picasso.
And i want to add the image to bitmap first and then add it to an imageview. I'm using the following line of code that adds an image from gallery with uri and show it on image view. I want to save it on a bitmap first. what should i do:


but i want to save it on a bitmap first.


Picasso holds Target instance with weak reference.
So it is better to hold Target as instance field.

private Target mTarget;

void loadImage(Context context, String url) {

    final ImageView imageView = (ImageView) findViewById(;

    mTarget = new Target() {
        public void onBitmapLoaded (final Bitmap bitmap, Picasso.LoadedFrom from){
            //Do something


        public void onBitmapFailed(Drawable errorDrawable) {


        public void onPrepareLoad(Drawable placeHolderDrawable) {