Reputation: 1
I am writing a very simple application in opengl es 11 for android and I would like to exit the application when the user pushes an "exit" button.
The problem is that the finish() method in the activity class does not work, the onDrawFrame keeps being called and the application can't be closed unless the user pushes the back button.
I understand that closing the application from the code is not in the logic of Android but this is just an exit button!
PS: I would like to close the app from the onDrawFrame method
Upvotes: 0
Views: 352
Reputation: 26925
I would like to close the app from the onDrawFrame method
That is not a valid way of 'closing' an Android application and should not be considered at all. You should, in your activity class, keep a reference to your renderer and whenever the activity pauses/resumes it automatically calls onPause()
/onResume()
. Call GLSurfaceView.onPause()
and GLSurfaceView.onResume()
respectively from those methods.
Upvotes: 1