0

I am using picasso for my application and it works like charm. But I need a way (in runtime and on production code) to determine if the images are either loaded via the network or from cache/disk.

enter image description here

In debug mode you can see the green,yellow and red indicators, but is there a way to determine that programmatically in production?

Cheers.

JacksOnF1re
  • 3,336
  • 24
  • 55

1 Answers1

1

If you load the image directly into an ImageView, I'm not sure that it's possible to check where it's loaded from. However, if you used the Target interface, you can use the Picasso.LoadedFrom flag to determine if it was loaded from memory, disk, or network.

However, if you use Target's to load your images, make sure you take care to make sure they're not GCed/fall out of scope before the load is finished, since Picasso doesn't keep strong refs.

Submersed
  • 8,810
  • 2
  • 30
  • 38
  • In conunction with the answer of this question: http://stackoverflow.com/questions/24180805/onbitmaploaded-of-target-object-not-called-on-first-load , I was able to solve my problem. Thanks – JacksOnF1re Apr 13 '15 at 17:55