- jobject getReturnObject(JNIEnv* env, jobject anInstance, const char* name,
- const char* signature) {
- jclass testClass = env->GetObjectClass(anInstance);
- if (!testClass) {
- LOGW("error 1");
- return NULL;
- }
- jmethodID methodID = env->GetMethodID(testClass, name, signature);
- if (!methodID) {
- LOGW("error 2");
- return NULL;
- }
- jobject result = env->CallObjectMethod(anInstance, methodID);
- if (!result) {
- LOGW("error 3");
- return NULL;
- }
- return result;
- }
- //该片段来自于http://www.codesnippet.cn/detail/240520133543.html
来源: http://www.codesnippet.cn/detail/240520133543.html