Reputation: 1068
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??
Upvotes: 1
Views: 2599
Reputation: 48
Just try to use jfloatArray imageArray = (jfloatArray) env->CallObjectMethod(Object,method);
It should resolve your problem .
Upvotes: 1
Reputation: 310985
CallFloatMethod()
is for calling methods that return float
. You are calling a method that returns float[]
. You should be calling CallObjectMethod()
.
Upvotes: 0
Reputation: 1270
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);
Upvotes: 0