如何使用作业数组?(杰尼)

In fact, I call a c++ function :

JNIEXPORT void JNICALL Java_test_main_JniFunctions_testObject (JNIEnv *env, jobject obj, jobjectArray objArray){....}

And what I'd like to do, is get back the original object's values. Considering the java code declaration for this object :

jniFct.testObject(new Object[][]
        {   
            {"testTable"},
            {0, 0.0, "aaa"},
            {1, 1.1, "bbb"},
            {2, 2.2, "ccc"}
        });

In exemple, get the value from the third row in the second column.

Anybody's got an idea on how to do it ??

解决方案

jobject row = env->GetObjectArrayElement(objArray, 2);
jobject value = env->GetObjectArrayElement((jobjectArray)row, 1);
const char* cvalue = env->GetStringUTFChars((jstring)value, 0);

相关文章