question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Target.onBitmapLoaded() method not called the first time after completed (network) request.

See original GitHub issue

onBitmapLoaded() is not called immediately after fetching has been completed. But when I load the image second time (which I suppose is already cached) the method is indeed called.

The code I use:

Picasso.with(this)
        .load(pictureUrl)
        .into(new Target() {
            @Override
            public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {
                // not being called the first time
            }

            @Override
            public void onBitmapFailed(Drawable errorDrawable) {

            }

            @Override
            public void onPrepareLoad(Drawable placeHolderDrawable) {

            }
        });

Picasso version: 2.1.1

Issue Analytics

  • State:closed
  • Created 10 years ago
  • Comments:19 (3 by maintainers)

github_iconTop GitHub Comments

37reactions
Gryzorcommented, Jan 6, 2014

Given the number of people (myself included the first time I used a Target) who make this mistake, wouldn’t it be wiser to add some sort of “bigger” warning?

Read more comments on GitHub >

github_iconTop Results From Across the Web

onBitmapLoaded of Target object not called on first load
It will manage the WeakReference objects for each of your views - as soon as one is no longer needed, whatever Target processing...
Read more >
Using Picasso in Android | Engineering Education (EngEd ...
It ensures the image is not downloaded every time it is needed. Fading: This refers to an animation feature offered by Picasso. Supports ......
Read more >
Android – Picasso not loading bitmap into imageview with target ...
Here's a complete method. First it reads image size without decoding the content itself. Then it finds the best inSampleSize value, it should...
Read more >
Target (picasso 2.71828 API)
Represents an arbitrary listener for image loading. Objects implementing this class must have a working implementation of Object.equals(Object) and Object.
Read more >
Networking - Android Mobile App Development Guide - Peruzal
It was one of the first networking libraries released for Android and provides ... To verify network availability you can then define and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found