Two bugs about restore on andorid

Hi @pickerel,

Where are you saving the snapshot, as I mentioned before? When you want to create a snapshot or capture of something that needs to persist on Android, you should do so, then immediately “display.save()” it, then remove the original object, and finally re-load it via “display.newImage()” or “newImageRect()”. By doing that, Corona will be able to restore the image when the app resumes. The key thing being is you have to “display.save()” it immediately… don’t wait to do it later, like during suspend, because then it is too late, and there won’t be any textures in OpenGL to save. In other words, do a “display.save()” in the same code block that is doing the snapshot/capture.

Best regards,

Brent

Hi @Brent,

I understand what’s you mean, but you’d better take a look at the code. It implements a finger drawing function, and the snapshot will be updated continuously within a touch event. If I do as your suggestion, I must saving the snapshot in touch event, It’s very inefficiency. Maybe I can do a delay with a timer,  save the snapshot every 1 or 2 seconds, but it’s still inefficiency, and some data may be lost.

Thanks

Pickerel 

Hi @pickerel,

Hmm, I see your point now. Saving the snapshot on every “moved” touch phase is unrealistic, but in practice, it seems like the only time the user would “suspend” the app would be between drawing motions (meaning, who would be in the middle of drawing something and click the power button off or close the app?). So, you could save the snapshot each time the draw motion ended, or even every 2nd or 3rd time, and realistically I think the user would not see any major issues in that.

This is, by the way, a fairly annoying aspect of Android that we can’t control, and iOS handles it more gracefully.

Brent