i have a glsurfaceview renderer with some code that allows me resume after press home button and enter again on the game, and that works fine, but if i close the game with the return button, and i try enter again to the game, it crashes and close.
i’ve tried writing finish() on OnDestroy but not work.
i already checked that onDestroy() execute it when i press return button.
in onSurfaceCreated i have functions that load textures and set vertices for draw those textures, but, i dont understand what could be happening
edit:
this is the log after i launch the game the second time, having closed it before
05-08 20:30:41.069: I/GLThread(6272): noticed surfaceView surface lost tid=12
05-08 20:30:41.069: I/GLThread(6272): onResume tid=12
05-08 20:30:41.169: I/GLThread(6272): noticed surfaceView surface acquired tid=12
05-08 20:30:41.169: W/EglHelper(6272): start() tid=12
05-08 20:30:41.219: W/EglHelper(6272): createContext com.google.android.gles_jni.EGLContextImpl@4056d398 tid=12
05-08 20:30:41.219: I/GLThread(6272): noticing that we want render notification tid=12
05-08 20:30:41.219: W/GLThread(6272): egl createSurface
05-08 20:30:41.219: W/EglHelper(6272): createSurface() tid=12
05-08 20:30:41.219: W/GLThread(6272): onSurfaceCreated
05-08 20:30:41.219: W/GLThread(6272): onSurfaceChanged(480, 320)
05-08 20:30:41.379: W/EglHelper(6272): destroySurface() tid=12
05-08 20:30:41.389: W/EglHelper(6272): finish() tid=12
05-08 20:30:41.389: W/dalvikvm(6272): threadid=9: thread exiting with uncaught exception (group=0x40018578)
05-08 20:30:41.389: E/AndroidRuntime(6272): FATAL EXCEPTION: GLThread 12
05-08 20:30:41.389: E/AndroidRuntime(6272): java.lang.NullPointerException
05-08 20:30:41.389: E/AndroidRuntime(6272): at glfg.gl.render.setverticesSquare(render.java:180)
05-08 20:30:41.389: E/AndroidRuntime(6272): at glfg.gl.render.onSurfaceChanged(render.java:475)
05-08 20:30:41.389: E/AndroidRuntime(6272): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1381)
05-08 20:30:41.389: E/AndroidRuntime(6272): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1138)
05-08 20:30:41.399: I/GLThread(6272): onPause tid=12
if i kill the process, i can enter again without problems, but if i exit with return button, it crashes when i try to launch it again, it’s supposed that the app would be closed totally but seems that not
Your error is here:
In glfg.gl.render.setverticesSquare at line 180. Is this part of your code? I’d look at that line and see what objects could be null, or preferably use breakpoints to inspect it.