JNIEXPORT void JNICALL Java_org_cocos2dx_cpp_Test_Change
(JNIEnv *env, jclass jc, jstring str)
{
pGame = new GameScene();
if(pGame != NULL){
__android_log_print(ANDROID_LOG_INFO, "JNIMsg", "....");
const char *code = env->GetStringUTFChars(str,NULL);
if(code == "start"){
pGame->daying();
//pGame->init();
//pGame->toStart();
}else{
__android_log_print(ANDROID_LOG_INFO, "JNIMsg", "code == NULL");
}
env->ReleaseStringUTFChars(str,code);
}else{
__android_log_print(ANDROID_LOG_INFO, "JNIMsg", "GameScene is NULL");
}
}
在java中传进来一个string类型的start 然后用const char 获取到这个值 当我用if去判断这个值==“start”的时候并没有执行下去而是执行了else那里 这是怎么一回事啊
我用jstring codename = newStringUTF(code);然后再去判断就报错了 这个该怎么去判断啊
判断两个字符串相等的时候不能直接用“==”