I am having great success with everything I’ve been using in Corona, but I’m stuck on one issue.
The app that I am working on allows the user to select a custom background from their image gallery (I display it, take a screenshot, save it to the OS, then use the screenshot file) and everything works great the first time, but I seem to be experiencing a strange caching issue when the user changes his/her mind and selects a different background image a second time. I am overwriting an image file each time, but no matter how many times I change the image file, and re-read it, the image file only seems to be actually read the first time after the app is launched. When the app is re-launched, it correctly reads the saved file, but subsequent reads of the same file (even after the file has changed) result in the original image displaying.
As best as I can tell, if you run the following line:
local photofromfile = display.newImage( ‘screenshot.png’,system.DocumentsDirectory,100,100)
Then overwrite the image named ‘screenshot.png’ with a new image (through code in your app)
Then run the following line:
local photofromfileagain = display.newImage( ‘screenshot.png’,system.DocumentsDirectory,100,100)
The image that is read will be the same as the first, and will not reflect the changes you made to the screenshot.png file.
Re-launch the app, and the newest changes will appear the first time you read the file, but subsequent changes will not appear until app relaunch.
I have sample code if that would help.
Any ideas? Any suggestions on how to nuke a cached image?
-Chris
[import]uid: 4418 topic_id: 415 reply_id: 300415[/import]