Hi!
So I am about to call java func from cpp in cocos2d-x using this code:
void HelloWorld::menuCloseCallback(Ref* pSender)
{
JniMethodInfo t;
if (JniHelper::getStaticMethodInfo(t,
"org/cocos2dx/cpp/AppActivity",
"sayHello",
"(Ljava/lang/String;I;)Z;")) {
const char* myName = "Beautiful Name";
int times = 3;
jstring stringArg1 = t.env->NewStringUTF(myName);
jboolean retV = t.env->CallStaticBooleanMethod(t.classID,
t.methodID,
stringArg1,
times);
t.env->DeleteLocalRef(t.classID);
t.env->DeleteLocalRef(stringArg1);
}
}
And my AppActivity:
public static boolean sayHello(String to, int times)
{
Log.w("myApp", "BOOOOLLLLL");
return true;
}
But when I try the app it returns the error, Failed to find static method id of sayHello can u find the issue here?
Thanks!