Reputation: 93
I am building android application and using Picasso lib to download the image from url.
Now I wanna to download and store in app so I can use it any time any where I need it.
I am using below code to download the image
Picasso.with(getActivity())
.load(profilePic)
.transform(new CircleTransform())
.into(userimg);
Upvotes: 1
Views: 923
Reputation: 18243
Picasso
has a thing called Target
to intercept a Bitmap
as it comes in.
class MyTarget implements Target {
private ImageView imageView;
public MyTarget(ImageView imageView) {
this.imageView = imageView;
}
@Override
public void onBitmapLoaded(final Bitmap bitmap, Picasso.LoadedFrom from) {
this.imageView.setImageBitmap(bitmap);
}
}
With this you can do:
Picasso.with(context).load(url).into(new MyTarget(imageView));
And set the Bitmap
to an ImageView
there (in the Target
).
Upvotes: 2