通过JNI如何将JAVA Float转换成C的float类型 ,注意,JAVA类型是Float
JAVA :
Float x = new Float(x);
C:
JNIEXPORT jint JNICALL Java_com_test(JNIEnv * env, jobject obj, ...,jobject score){
// jobject对应的是JAVA的 Float对象
请问如何将jobject的值赋值给C语言的float
float fs = score;//这个地方应该如何转换呢
}
jobject fScore
------解决方案-------------------- jfieldID fieldId = (*env)->GetFieldID(env, objectClass, "value", "F");
jobject myobject = score;
jmethodID methodID = (*env)->GetMethodID(env,objectClass,"floatValue","()F");