Is there a way to listen for events from Picasso when using the builder like:
Picasso.with(getContext()).load(url).into(imageView);
I'm trying to call requestLayout()
and invalidate()
on the parent GridView
so it'll resize properly but I don't know how to set a listener or callback.
I see that Picasso has error event reporting, but is there a success event?
If you need to access the bitmap before it is loaded to the view, try using :
In the calling method:
Ideally you'd implement Target on a view or view holder object directly.
Hope this helps
As a complement to other answers, in case you don't know where to use original image view, e.g.
ImageView myIV
:Original:
New (inside
onBitmapLoaded()
ofnew Target()
):Answering @Jas follow up question as a comment to MrEngineer13's answer (since I don't have enough reputation to comment in any answer), you should use the
error()
method prior to registering theCallback
at theinto()
method, for example:You can use a
Callback
to get onSuccess and onError events. Just add a new Callback to your request like so:Then you can perform any alterations and modifications in the onSuccess callback.
Try This