Both can and both have already been answered on this site.
Using Picasso:
private Target mTarget = new Target() {
@Override
public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {
// Do whatever you want with the Bitmap
}
@Override
public void onBitmapFailed(Drawable errorDrawable) {
}
@Override
public void onPrepareLoad(Drawable placeHolderDrawable) {
}
}
...
Picasso.with(this).load("url").into(mTarget);
You have to keep a reference to the Target
instance at least as long as the request is in progress. You can cancel the loading later by calling cancelRequest()
.
Using UIL:
imageLoader.loadImage(imageUri, new SimpleImageLoadingListener() {
@Override
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
// Do whatever you want with the Bitmap
}
});