Java – JNI, call boolean method
•
Java
I get a Java method, get a string and return bool
I call it JNI this way:
jmethodID function2ID = env->getmethodID( activityClass,"MyFuncName","(Ljava/lang/String;)B"); if ( function2ID == null ) LOG("Could not find MyFuncName Function") jboolean IsAutoPlay = env->CallBooleanMethod( obj,function2ID,env->NewStringUTF(name));
I get a fatal signal 11. What's wrong with any idea in grammar? thank you
Answer: my java signature returns Boolean instead of Boolean
also
jmethodID function2ID = env->getmethodID( activityClass,"(Ljava/lang/String;)B");
Need Z instead of B
jmethodID function2ID = env->getmethodID( activityClass,"(Ljava/lang/String;)Z");
Solution
My java signature returns Boolean instead of Boolean
Jmethodidfunction2id = env - > getmethodid (activityclass, "myfuncname" "(ljava / Lang / string;) B”); Need Z instead of B
jmethodID function2ID = env->getmethodID( activityClass,"(Ljava/lang/String;)Z");
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码