java - Resolving Android / OpenGL IllegalStateException -


There is another activity in my app that contains a GLSurfaceView. This first activity shows the OpenGL ES 1.0 chart of data collected. All things, including the orientation change, works fine, the app can pop out in two activities, the orientation can handle the change and nothing is wrong.

However, if I am showing the OpenGL charts on second activity and pressing the Android Home screen, then I get this message in the app by selecting from the list of apps on the Back menu.

In logcat I see this "Unfortunately, XXX has stopped.": IllegalStateException: setRenderer has already been asked for this example and I for The bottom is tracked by mGLView.setRenderer (New GLRenderer (this)); The line of code I have in action for is onStart () method.

I put the log line in front of this line and immediately after this call ... When the accident occurs, I see the following in the logcat ...

  02-18 09: 48: 08.743 1953-1953 / Com.IPPOHPAP I / Alert? Just before the set renderer call ... 02-18 09: 48: 08.753 1953-1953 / Com.Hipo HHDD / Android Rendime? VM 02-18 09: 48: 08.753 1953-1953 / Com. IPPOHPPW / DualWiki Closing? Thread = 1: The thread gets out with the absent exception (group = 0xb0d75b08) 02-18 09: 48: 08.763 1953-1953 / Com. POPO HPP E / Android Runtime? Fatal Exceptions: Main Process: com.hippo.happ, PID: 1953 java.lang.RuntimeException: unable to resume activity {com.hippo.happ / com.hippo.happ.HChartActivity}: java.lang.IllegalStateException: SetRenderer has already been called for this example  

but I do not see it, unless the activity is being created for the first time:

 < Code> 02-18 09: 47: 51.123 1953-1953 /com.hippo.happ I / Sense? Just setRenderer call ...  

I can confirm that I'm not not calling setEGLContextClientVersion at all, neither I Shuffling Rendering Mode with setRenderMode . I have is implemented onPause () and onResume () .

Did I call "codeRenderer already for this example" (I can not see a proper get or check the method in docs) or I just set it to setRender Try..catch in the block line and blissful IllegalStateException can surround / code>? Is it that recommended might be to get around this?

The view of the activity onStart () is said at the beginning of the lifetime so when you go to the home screen And come back, this is the first biography that runs. Since you set the renderer in that method, if fails because it was previously set, when the activity was created. You should set the renderer as part of the OnCreate (Ideal) since the activity started when that started again.

I think that you have a square, that is the GLSurfaceView, which you can see in the illustration onCreate ( ) Of subclasses, you can set the renderer in the manufacturer of that class. Or if your code does this already, but in the Open Start (), it prompts glossophoswizive, then it is expected that it will be created on the CREATE Going to be a case


Comments