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

  • 相关阅读:
    人事面试测试篇25
    人事面试测试篇19
    人事面试测试篇24
    人事面试测试篇20
    人事面试测试篇18
    人事面试测试篇23
    人事面试测试篇21
    人事面试测试篇17
    明天……
    重装系统
  • 原文地址:https://www.cnblogs.com/Ph-one/p/4693821.html
Copyright © 2011-2022 走看看