I. Problems:
The interface on the Cocos2d-x is spent on returning messages by calling C ++ (Cocos2d-x) functions from the Java (Android) side
Check the Log of Eclipse and see the call to OpenGL es api with no current context (logged once per thread) error.
Ii. solution:
After looking for information to understand this problem is because Android in the startup of the cocos2d-x Thread, the main Thread of the context is not used, but the use of OpenGL Thread,
Therefore, we cannot complete the work in the main Thread. This should be done in the OpenGL Thread of cocos2dx (that is, the work of the called function in Cocos2dx)
It must be completed using OpenGL Thread ︰
Java (Android)-Cocos2dxActivity. java
You should use runOnGLThread to complete the corresponding work in the Activity of Cocos2dxActivty.
Public static native void nativeCallback (String code, String params );
Public static void runNativeCallback (final String code, final String params)
{
Cocos2dxGLSurfaceView. getInstance (). queueEvent (new Runnable (){
@ Override
Public void run (){
NativeCallback (code, params );
}
});
}