recently I’m studying call java methods from C*+ with JNI, and there’s a non-static method in java which should be triggered by C**, then I found below sample codes:
public void cppCall_nonStatic_logsth{
Log.i;
}
public static Object cppCall_logsth{
Log.i;
return activity;
}
JniMethodInfo minfo;
jobject jobj;
bool b = JniHelper::getStaticMethodInfoLjava/lang/Object;");
if {
LOGD (“JniHelper::getStaticMethodInfo error…”);
}else{
jobj = minfo.env~~>CallStaticObjectMethod;
}
JniHelper::getMethodInfoV");
if{
LOGD (“JniHelper::getMethodInfo error…”);
}else{
LOGD (“ready to invoke method…”);
minfo.env~~>CallVoidMethod;
}
the main process is to call a static java method to get activity object, and then using this object to call a non-static java method.
however, i cannot find such a static activity object in Cocos2dxActivity. Is anyone knows anything about this issue, or other sample codes to trigger a non-static java method from C*+ via JNI?