Problem: Image doesn’t update in a view. Actually, two different images used in two different views.
Two different image URLs are loaded to the same filename in system.TemporaryFiles. The file should update, but it doesn’t. So I added a line to delete the file with os.remove just before the call to loadRemoteImage, and still I get the same image when newImageRecting it in the view.
What have I tried:
-
made sure all view variables are local
-
checked so the image isn’t staying and covering the real image in the view somehow
-
renamed the destination filename for the second file. then it works. but I can’t really have a filename generator for each image that I load, I’d fill up the phone’s storage.
Any ideas?
Edit: os.remove didn’t delete the file because it is being kept open, even though the previously loaded image has resulted in an object. Unfortunately I’m using a mobile web page menu which means I can’t removeSelf() the view, which might close the file.
The file being open also affects loadRemoteImage being able to overwrite the file. But I get no error message in its listener, it just pretends it loaded fine and gives me a valid image object in target – just the previously loaded image.
Still working out how to do this without display.remove()ing the old image. Cyclically numbered file names, perhaps.