java回調C++

1.java調用C++帶一個 int 參數

(1)java類名CaddCall

    public  native  static  int  retGooglePlay(int pResult);

    調用通過CaddCall. retGooglePlay(22)

(2)c++


#include"JniHelper.h"

#include"platform/android/jni/JniHelper.h"

_org_play_test_ 包名、類名、方法名

extern "C" {
JNIEXPORT void JNICALL Java_org_play_test_CaddCall_retGooglePlay(JNIEnv* env,
        jobject thiz, jint pResult) {
    int aa = pResult;
    char buf[10];
    sprintf(buf, "%d", aa);
    std::string b = buf;
    CCMessageBox("12ss3", b.c_str());
}
}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章