Reputation: 89
I'm getting app crash when i try to pass WCHAR_T* to java method.
I have WCHAR_T* variable and it length.
I down know how to cast it to jstring to call java method.
my c++ code :
bool test(WCHAR_T* document){
JNIEnv* jenv = getJniEnv();
methodID_test = jenv->GetMethodID(cc, "test", "(Ljava/lang/String;)Z");
return (bool)(jenv->CallBooleanMethod(obj,methodID_printDocument,document));
}
my java code :
public boolean test(String document) {
return false;
}
Upvotes: 2
Views: 731
Reputation: 1023
Use the NewString function to convert wchar_t to jstring.
jstring NewString(JNIEnv *env, const jchar *unicodeChars, jsize len);
Upvotes: 1