Reputation: 3887
The Android Docs state that for surfaceCreated, surfaceChanged and surfaceDestroyed:
This method is part of the SurfaceHolder.Callback interface, and is not normally called or subclassed by clients of GLSurfaceView
However, they are called in my (OpenGL ES 2.0) app.
This is the order of things in my App
App Launched
Now I press Home key before onSurfaceChanged is called, so app is now in the background
So, as you can see, according to the above, the surface is destroyed and then it is changed - obviously this is impossible.
The app works fine. I can then re-launch it and everything works.
I'm just a little confused. My guess is that surfaceCreated, surfaceChanged and surfaceDestroyed are called, but have no effect on my GLSurfaceView.
Can anyone confirm this is the case?
Upvotes: 0
Views: 1241
Reputation: 54592
I think you might have misunderstood the documentation. It is not saying that these methods are not called. With emphasis added:
is not normally called or subclassed by clients of GLSurfaceView
What this is telling you is that if you use the GLSurfaceView
class, which makes you a client, you are not supposed to call these methods. In addition, if you subclass GLSurfaceView
, they do not recommend that you override these methods.
In other words, these methods are intended for internal use. They are called, but you should normally leave it up to the GLSurfaceView
to handle the calls. As a user of GLSurfaceView
, you should not worry about these methods at all, and use the recommended and well documented methods when you subclass GLSurfaceView
, and interact with instances of GLSurfaceView
.
Upvotes: 1