I'm calling a java method from jni.This method return a float[]
jclass javaClass = env->GetObjectClass(activityObj);
jmethodID method = env->GetMethodID(javaClass,"findparam", "([FF)F");
jfloatArray rotateArray = env->CallFloatMethod(activityObj, method, s1, s2);
But when i tried to compile it i had :
error: cannot convert 'jfloat' to '_jfloatArray*' in initialization
how can i get the returnet float array??
Just try to use jfloatArray imageArray = (jfloatArray) env->CallObjectMethod(Object,method);
It should resolve your problem .
All array types (even primitive types) are returned as a jobject
which you should then cast to the appropriate j<type>Array
type.
So your final line should read:
jfloatArray rotateArray = (jfloatArray)env->CallObjectMethod(activityObj, method, s1, s2);
CallFloatMethod()
is for calling methods that return float
. You are calling a method that returns float[]
. You should be calling CallObjectMethod()
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.