It makes me cry. JNI is a necessary evil, but still evil.
Why isn't there some nice way to call a CallStringMethod? Especially when working with
Android's bundles, which have getString. It would make life a million times easier.
Anyway here's a workaround:
jstring my_java_string = (jstring)env->CallObjectMethod(bundle, myBundle.getString, env->NewStringUTF("test"));
if(my_java_string== NULL){
// Error
return;
}
char*my_c_string= strdup(env->GetStringUTFChars(my_java_string, 0));
env->ReleaseStringUTFChars(my_java_string,my_c_string);
A blog about computer and electronics projects to make life just that little bit sweeter.
Showing posts with label GetStringMethod. Show all posts
Showing posts with label GetStringMethod. Show all posts
Wednesday, October 6, 2010
JNI - where's the env->CallStringMethod?
Subscribe to:
Posts (Atom)