What is “jobject thiz” in JNI and what is it used for?

后端 未结 3 1873
傲寒
傲寒 2020-12-31 06:25

I am having a hard time finding an answer to this. But, what is \"jboject thiz\" used for in JNI function calls? For example:

jobjectArray Java_com_gnychis         


        
3条回答
  •  渐次进展
    2020-12-31 06:43

    I found this link that should help clarify the question.

    https://library.vuforia.com/articles/Solution/How-To-Communicate-Between-Java-and-C-using-the-JNI

    Here is an example in it that uses the "jobject".

    JNIEXPORT void JNICALL
    Java_com_qualcomm_QCARSamples_ImageTargets_ImageTargets_initApplicationNative(
                                JNIEnv* env, jobject obj, jint width, jint height)
    {
        ...
        jclass activityClass = env->GetObjectClass(obj);
        jmethodID getTextureCountMethodID = env->GetMethodID(activityClass,
                                                        "getTextureCount", "()I");
        if (getTextureCountMethodID == 0)
        {
            LOG("Function getTextureCount() not found.");
            return;
        }
        textureCount = env->CallIntMethod(obj, getTextureCountMethodID);
        ...
    }
    

提交回复
热议问题