zoukankan      html  css  js  c++  java
  • 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显示出来。虚心请教

  • 相关阅读:
    Odoo权限设置机制
    Odoo10配置文件
    Odoo10——self的使用
    Odoo10 启动选项
    ubuntu安装nginx
    pycharm快捷键一览
    前端 -- HTML
    前端 -- CSS
    前端 -- JavaScript
    前端 -- BOM和DOM
  • 原文地址:https://www.cnblogs.com/Ph-one/p/4693821.html
Copyright © 2011-2022 走看看