André Freitas
André Freitas

Reputation: 141

How to load an image with Picasso from url inside a notification with a callback?

I would like to load an url that contains an image to a notification (using picasso library) and as callback i would like to load another image if occurs an error. I found to code for this without callback.

Picasso.with(context).load(url).into(remoteViews, R.id.image, notificationID, notification);

Upvotes: 0

Views: 2019

Answers (1)

nshmura
nshmura

Reputation: 6000

If the code will not run on UI Thread.You can do like following:

Bitmap bitmap = Picasso.with(context).load(url).get();
ImageView imageView = (ImageView) remoteViews.findById(R.id.image);
imageView.setImageBitmap(bitmap);

Upvotes: 1

Related Questions