jni数据问题
目的:
jni中(c++函数)一个 char buf[4] 如何通过env->CallVoidMethod(clazz,method_OnFindCards,jStringParam); 在app上显示出来
比如:
//获得Java层的回调函数
jclass mClazz = env->FindClass("com/android/server/RfidReaderService");
LOGI("the mClazz is obtained from the jobject clazz");
method_OnFindCards = env->GetMethodID(mClazz, "onFindCards","(Ljava/lang/String;)V");
if (method_OnFindCards== NULL)
{
LOGI("Fail to find method onFindCards");
}
LOGI("the method_OnFindCards is obtained ok!");
//(1)执行寻卡操作:
//(2)找到卡后,调用Java层的回调函数: cardNumber是一个jstring类型的字符串
jstring jStringParam = env->NewStringUTF("this is the value from the calling in the close reader in jni");
env->CallVoidMethod(clazz,method_OnFindCards,jStringParam);
在app上可以显示“this is the value from the calling in the close reader in jni”,,如何把buf中数据替换到该位置,同样在APP显示出来。虚心请教