Simply talk about the UI thread: In Android, there is a very important guy who is very overbearing, that is, the UI thread. One of these overbearing: can't be blocked. Second: the system's calls to each component are distributed from the UI thread.
Simply say OpenGL threads: Any COCOS2DX-initiated drawing thread is an OpenGL thread. Just so much
Any call to the SDK interface must be called from the UI thread, so it needs to be placed in the main thread. If we call directly from the GL thread, the light is not called, and the heavy program jumps to death.
Workaround:
Get the main thread of the handler, here is a simple, that is, in the OnCreate new static handler.
or New Handler (Looper.getmainlooper ()), and call it MainHandler,
Start a thread,
Thread Sendthread=new Thread (new Runnable () {public void run () {mainhandler.post (Sendrun);}});
Public Runnable sendrun=new Runnable () {@Overridepublic void run () {////Here you can invoke something inside the SDK.
}};
<span style= "Font-family:verdana, Arial, Helvetica, sans-serif;font-size:12px; line-height:27px; " > How to invoke OpenGL threads from the UI thread, call directly, I've done it before, feel like nothing's been found (he he), and if I find a problem I think it's better to call it that way </span>
Cocos2dxglsurfaceview.getinstance (). Queueevent (New Runnable () {public void run () {<span style= "White-space:pre" ></span>//callback what Horse's}});
As for wanting to know, JNI native something also please go out right and not send
<cocos2dx > About COCOS2DX pick up some pits for Android SDK