I'm currently getting to grips with Android, playing around with the Lunar Lander sample.
I've found that if you navigate away from the app (eg, hit the call button) it will destroy the underlying surface (calling surfaceDestroyed
).
Navigating back (which will trigger onWindowVisibilityChanged
) the app will crash, as it will try to draw to the surface without recreating it.
Is there some code I can put in onWindowVisibilityChanged
(or anywhere else) that will regenerate the SurfaceView's underlying surface and resume execution nicely?
It feels like this should be a simple function call but I can't find anything in the API docs.
Thanks!