| 116 | |
| 117 | |
| 118 | std::string JniUtils::callStringMethod(JNIEnv *env, jobject jObj, jmethodID method) { |
| 119 | if (env == nullptr || jObj == nullptr || method == nullptr) { |
| 120 | return ""; |
| 121 | } |
| 122 | |
| 123 | CallObjectMethod tmpGetObject(env, jObj, method); |
| 124 | auto objec = (jstring) tmpGetObject.getValue(); |
| 125 | GetStringUTFChars tmpObj(env, objec); |
| 126 | char *ch_Obj = tmpObj.getChars(); |
| 127 | return ch_Obj == nullptr ? "" : std::string(ch_Obj); |
| 128 | } |