Image caching in Tableviewrow?
Hi!
I have a tableview with an image in each row. These images are retrieved from a server. However, they don't seem to be cached: If I scroll down, and back up, the images on top, that have been loaded before, have to be requested from the server again. This is quite slow (as the server connection takes some time).
In another app, this seems to be handled better, while the code is similar.
How does Titanium determine to cache an image?
7 Answers
-
I've solved this issue before and published up a git repo for general use. You can find it on my blog here and on Github here
-
I recommend to switch to the latest current build of the upcoming version 1.6. We had similar problems but in the current version the caching is fixed! Image caching comes automatically. If you use class names for similar rows the scroll experience with remote images is very good. They did a lot a this. Unfortunately row classing is not stable enough (on android).
-
Are you sure the images get requested again after scrolling down and up again?
They certainly never used to.
-
Well, I'm not 100% sure they do get requested again, although it does feel that way. They do dissapear and take a while to return tho. I'll test with a proxy at some point if they do get requested again.
I do know this isn't how it used to behave, but I didn't actively change anything. Maybe the image size is a factor? Maybe the way it's hosted? (headers, etc?) -
It seems my hunch about headers was right: the images on this new listing have a no-cache header, which seems to prevent Titanium from caching them, even for a few seconds.
I'm guessing I can change this in the titanium source, or ask if the server can be changed (which will be hard). -
we're experiencing this exact same issue….did you ever come up with a resolution?
Thanks
~Brian
-
Sven…
thanks for the heads up. We'll check it out once 1.6 is available. Android is our primary target platform….iPhone secondary.
~Brian