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());
}
}
转载于:https://blog.51cto.com/4447695/1252909