Search code examples
androidcanvasglsurfaceview

Android - GLSurface, errror while closing


Every time I occur an error while I close the app. I dont know why? Its occur only on 2.3.7. Everything working fine on 3.2 and 4

FATAL EXCEPTION: main
java.lang.NullPointerException
at android.opengl.GLSurfaceView.onDetachedFromWindow(GLSurfaceView.java:533)
at android.view.View.dispatchDetachedFromWindow(View.java:6190)
at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:1162)
at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:1162)
at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:1162)
at android.view.ViewRoot.dispatchDetachedFromWindow(ViewRoot.java:1751)
at android.view.ViewRoot.doDie(ViewRoot.java:2766)
at android.view.ViewRoot.die(ViewRoot.java:2736)
at android.view.WindowManagerImpl.removeViewImmediate(WindowManagerImpl.java:218)
at android.view.Window$LocalWindowManager.removeViewImmediate(Window.java:477)
atandroid.app.ActivityThread.handleDestroyActivity(ActivityThread.java:2822)
at android.app.ActivityThread.access$2100(ActivityThread.java:123)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:972)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3835)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:847)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:605)
at dalvik.system.NativeStart.main(Native Method)

Solution

  • Possibly a duplicate of this: GLSurfaceView.onDetachedFromWindow

    Is the game actually working and running when you close the window? In the other question sounds like they never attached the renderer, but I'm not sure if that's true in your case.