12
votes

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 ??

1

1 Answers

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