简体   繁体   中英

How to use a jobject array ? (Jni)

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);

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM