What platform are you working with?
The reason I ask is because before Eclair this whole area was riddled with errors, as a result of which the suspension / resumption of OpenGL basically worked only by accident. However, it looks like they were fixed with Eclair, and our application seems to pause and resume reliably enough.
What you have to do is register a callback to SurfaceHolder so that you get a notification when the surface appears and disappears. In the surfaceDestroyed () method, you completely close the EGL, and then in the surfaceCreated () method you reinitialize it. You should not do this from the Activity onCreate () / onResume () methods, since the surface may not display and disappear at the same time.
However, our app was developed for Cupcake when everything was pretty primitive. I understand that these days there are utility classes available that make it hard for you, so if you use one of these things, you can work differently; and if you do not, you can look in them.
David Given
source share