I know this forum is full with "Android doesn't display image" questions, but none of them seems to coincide with what I am experiencing.
When I use the debugger and step through my code, it works fine and the image is shown. But when I don't halt the code, it does not update the image at all, or it updates it much later.
This looks like Android isn't invalidating the view, but adding invalidate() does not help either. Any thoughts?
Here is the code:
Picasso.with(getContext()).load(url).into(new Target() { // using Picasso to load the image
@Override public void onPrepareLoad(Drawable placeHolderDrawable) {
}
@Override public void onBitmapLoaded(final Bitmap bitmap, Picasso.LoadedFrom from) {
screenSurface.setImageBitmap(bitmap); // trying to display it, screenSurface is the ImageView
// I tried adding screenSurface.invalidate() here but it doesn't help
}
@Override public void onBitmapFailed(Drawable errorDrawable) {
}
});
As it looks to me this is a problem with Android, not Picasso, as Picasso seems to emit the callback on the UI thread. Otherwise the image wouldn't be shown during debug either.