[1 jobject<--->jclass|jstring]
(1)jobject向上转型jclass|jstring:
jclass jcls = static_cast<jclass>(jobject);
jstring jstr = static_cast<jclass>(jobject);
(2)jclass|jstring向下转型jobject:
默认情况下是自动转换的
[2 jstring<--->const char*]
(1)jstring-->const char*
const char* xxx = (*env)->GetStringUTFChars(env,jstring,NULL);
(2)const char*--->jstring
jstring xxx = (*env)->NewStringUTF(env,const char*);
[3 jlong-->long]
long是基本类型,直接赋值即可
long xxx = jlong;
看这张图就懂了!!!
[4 Native获取Java层函数接口]
java层:
public void onNotifyResult(ResultInfo resInfo);
Native层:(JNI)
jclass cls = env->GetObjectClass(p_JNInstance);
jmethodID onNotifyResult = env->GetMethodID(cls, "onNotifyResult",
"(Lcom/arcsoft/wideselfie/jni/JNIManager$ResultInfo;)V");
[5 Native获取Java层byte数组,并转换为OFFSCREEN]
[6
Unicode & UTF-8
]
const jchar *chars; //Unicode characters
const char *charsutf; //UTF-8 characters