Reputation: 11728
The documentation for the setPreserveEGLContextOnPause Android function states the following:
"...If set to true, then the EGL context may be preserved when the GLSurfaceView is paused..."
How do I check if the EGLContext was preserved or not upon the resumption of my activity?
If the EGLContext was not preserved I need to reload all of my textures, that is why it is important to me.
The only thing I was able to find that I though might be related to this question was the getPreserveEGLContextOnPause() method. But this method only returns true if the EGLContext will be saved, and even if it is saved it may be deleted by the system later, so this doesn't really seem to help.
Upvotes: 2
Views: 1426
Reputation: 3518
According to this text, you don't need to. The context loss is implicit and cannot be observed. When onSurfaceCreated()
is called, you know the context (has been lost|was never created) and must be recreated.
Alternatively, a possible workaround is to create some small object that is actually never used, but indicates that the context was not lost in the meantime. I'm not sure if this will work, though.
Upvotes: 2