এখান থেকে নেওয়া :
Picasso.with(this)
.load(url)
.into(new Target() {
@Override
public void onBitmapLoaded (final Bitmap bitmap, Picasso.LoadedFrom from){
theView.setImageBitmap(bitmap);
}
});
আপডেট (মে 04, 2016):
Picasso.with(this)
.load(youUrl)
.into(new Target() {
@Override
public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {
}
@Override
public void onBitmapFailed(Drawable errorDrawable) {
}
@Override
public void onPrepareLoad(Drawable placeHolderDrawable) {
}
});
আপডেট হয়েছে (নভেম্বর 22, 2016)
বা একটি শক্তিশালী রেফারেন্স ব্যবহার করে Target
যাতে এটি আবর্জনা সংগ্রহ না হয়
Target target = new Target() {
@Override
public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {
}
@Override
public void onBitmapFailed(Drawable errorDrawable) {
}
@Override
public void onPrepareLoad(Drawable placeHolderDrawable) {
}
};
void foo() {
Picasso.with(getContext()).load(getUrl()).into(target);
}
কোটলিন
object: com.squareup.picasso.Target {
override fun onBitmapFailed(e: java.lang.Exception?, errorDrawable: Drawable?) {
TODO("not implemented")
}
override fun onPrepareLoad(placeHolderDrawable: Drawable?) {
TODO("not implemented")
}
override fun onBitmapLoaded(bitmap: Bitmap?, from: Picasso.LoadedFrom?) {
}
}