I would like to deal with a byte array which is retrieved from java callback function.
However, I got an error 'JNIEnv' has no member named 'GetObjectElements'
jmethodID FuncGetArray = GetStaticMethodID(clazz, "GetArray", "()[B");
jobject data_obj = env->CallStaticObjectMethod(clazz, FuncGetArray);
const jboolean is_copy = JNI_FALSE;
jbyte *byte_array = env->GetObjectElements(data_obj, is_copy);
Can I get the pointer to get the byte array in a easy way instead of retrieving each element and copying it.
I think the function you are looking for is
GetByteArrayElements
. You can cast thedata_obj
you have to ajbyteArray
and pass it to that function.Also you should be passing a pointer to
is_copy
.