首页 > 其他 > 详细

jni数据问题

时间:2015-08-01 11:16:45      阅读:227      评论:0      收藏:0      [点我收藏+]

目的:

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显示出来。虚心请教

jni数据问题

原文:http://www.cnblogs.com/Ph-one/p/4693821.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!