In my Java code I have a 2D float array float[x][4] floatArray
. Here x
can be between 1 and 25. I have to pass this 2D float array to a C++
method via JNI
. My JNI
method is
jboolean MyJNIMethod(JNIEnv * env, jobject obj, jobjectArray myArray)
{
//how to convert this myArray to something that can be safely passed to C++ method below
}
Inside MyJNIMethod
I have to call a C++
method and pass 2D float array taken from Java to this method
bool MyCplusPlusMethod(float coordinates[][4])
{
}
I am having a hard time in properly converting jobject to float[][] due to lack of native development knowledge. Can anyone tell me the simplest and safest possible way? Thanks
See Question&Answers more detail:os