I am trying to get a string in return to a function call from cpp to java.
This is my JNI call
string GetIDJni()
{
cocos2d::JniMethodInfo methodInfo;
if (! JniHelper::getStaticMethodInfo(methodInfo, CLASS_NAME, "GetID", "()Ljava/lang/String"))
{
return "";
}
jobject retObj = methodInfo.env->CallStaticObjectMethod(methodInfo.classID, methodInfo.methodID);
jstring retStr = (jstring)retObj;
methodInfo.env->DeleteLocalRef(methodInfo.classID);
return (JniHelper::jstring2string(retStr));
}
On compiling i get the error
error: invalid conversion from '_jobject*' to '_jstring*'
Can anyone please tell me how to solve this problem.