Picasso Image Loading Library, some issues

1k views Asked by At

I'm building a small app that will mostly be a directory of certain businesses. Everything is obtained through a REST service. I am having some issues dealing with the images while browsing the list of businesses.

The images that compose each list item are a background (functions as the 'banner' for the business) and up to 5 small icons representing the most important services that business provides.

I started using Picasso to asynchronously load these images with the hope that I could avoid creating any caching of my own. However, I've encountered a couple issues:

A) The biggest one is that on a lower end phone (LG Optimus V running Android 2.2), the background/banner, ALWAYS fails to load. I am using the error() option of Picasso to load a placeholder drawable when an background fails to load, but every single one fails to load and I can't figure out why. Things I have noticed about this:

  • The small icons load just fine
  • The onImageLoadFailed callback from Picasso doesn't actually trigger. But the placeholder I specify with error() does load.
  • Memory doesn't seem to be the problem, as I am perfectly able to load these banners (same asset size) if they are local instead of remote.
  • This issue doesn't happen in a Droid X running 2.3 and a couple of higher end devices.

B) On all devices, neither the services icons nor the banners ever seem to cache to disk (Picasso debug mode indicates they always load first from the remote source, and from then on from memory) even though Picasso is supposed to do this automatically. Not sure if I am missing some setting or something.

Actually, the service icons would be best if I could prefetch them at the start of the app because they repeat a lot between list (business) items. They can't be local assets because the list of possible services can grow at any point and as such more icons will come about regularly. But it would be great if at the start of the activity I could query for my list of services (already have a REST point for that) and prefetch all the icons and cache them. Is there an 'easy' way to do this?

Thank you for any guidance on these issue.

1

There are 1 answers

0
RobertoCuba On BEST ANSWER

Late to answer this but here it is:

A) Turned out to be an issue with Android 2.2's bugged SSL implementation. My images are accessible through both HTTPS and HTTP. I was using the HTTPS URL's and the request were failing. I simply switched over to the HTTP URL's and everything started working fine in 2.2

B) I was never able to exactly know if this was really the case, if there was a bug in Picasso's debug mode or what. Upon testing more, I did notice that the app's cache storage did increase over time (i.e. as more images had been accessed more frequently) which would indicate that there was caching involved. However, I think it could be cached HTTP responses instead of cached image files which would explain why Picasso's debug mode indicated they were being requested from the source yet still appeared quickly as if cached.