OnSurfaceChanged called twice

I am creating an Android application using openGL ES and I have the following problem:

When I minimize the application, then open it again, onSurfaceChanged in my GLSurfaceView.Renderer is called 2 times.

I have the following code in onSurfaceChanged (and similar code in onSurfaceCreated, onDrawFrame):

Log.e("onSurfaceChanged",Integer.toString(width)+" "+Integer.toString(height));

So, I get the following log:

onSurfaceCreated
onSurfaceChanged 480 800
onDrawFrame
onSurfaceChanged 480 800
onDrawFrame
onDrawFrame
onDrawFrame
onDrawFrame
onDrawFrame
onDrawFrame
(...)

When I minimize, I change the screen orientation from portrait to landscape, and then open it again, onSurfaceChanged is called 3 times. And the magazine:

onSurfaceCreated
onSurfaceChanged 480 800
onDrawFrame
onSurfaceChanged 480 800
onDrawFrame
onDrawFrame
onDrawFrame
onSurfaceChanged 800 480
onDrawFrame
onDrawFrame
onDrawFrame
onDrawFrame
onDrawFrame
onDrawFrame
(...)

My question is: is this a mistake? Is there an Android error in my application? Is there a way that onSurfaceChanged is called only once? (because in onSurfaceCreated I am executing code that slows down the application)

+4
1

. onSurfaceChanged , GLSurfaceView. .

OpenGL, , onSurfaceChanged, ActivityCycle OpenGL.

, Android, Amazon Fire TV OUYA. , , , - GL onPause, onStop onRestart, , , , raw.

OpenGL onCreate, onRestart onResume ( , ). , , , .

, .

, , onSurfaceCreated , , - . , ActivityCycle, , Google.

+3

All Articles