jni数据问题
2015-08-01 11:04
169 查看
目的:
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中(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显示出来。虚心请教
相关文章推荐
- hdu 1151 - > 双向路径搜索解决覆盖问题
- Python中何时使用断言 assert
- 1024. Palindromic Number (25)
- hdoj5318
- 关于ECP直接修改ABAP代码
- Android保存之SharedPreferences
- Power of Cryptography
- 设计模式(19) - 策略模式
- hdu 1151 - > 双向路径搜索解决覆盖问题
- hdu 1151 - > 双向路径搜索解决覆盖问题
- MMM互助社区是不是真的,有没有风险
- tabbar点击刷新
- Nginx fastcgi_param解释
- hdu 1151 - > 双向路径搜索解决覆盖问题
- ubuntu14.04 安装HAXM(KVM)提升android虚拟机Android x8运行速度
- hdu 1151 - > 双向路径搜索解决覆盖问题
- 欧拉函数详解 + 整数唯一分解定理 + 欧拉定理(高阶幂次取模)
- Rings'n'Ropes (Uva 10985 floyd+枚举)
- 汇编调用c函数为什么要设置栈
- 3D打印技术之切片引擎(5)