Downloading image as Bitmap using Picasso
suggest changeTo 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.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents