android Programming Glossary: callobjectmethod
FindClass from any thread in Android JNI http://stackoverflow.com/questions/13263340/findclass-from-any-thread-in-android-jni name ... jclass c0 env FindClass name jclass c1 jclass env CallObjectMethod ClassLoader MID_loadClass envNewStringUTF name dlog myFindClass.. getClassLoader Ljava lang ClassLoader gClassLoader env CallObjectMethod randomClass getClassLoaderMethod gFindClassMethod env GetMethodID.. findClass const char name return static_cast jclass getEnv CallObjectMethod gClassLoader gFindClassMethod getEnv NewStringUTF name JNIEnv..
Calling a java method from c++ in Android http://stackoverflow.com/questions/5198105/calling-a-java-method-from-c-in-android String V Call the method on the object jobject result env CallObjectMethod jstr messageMe Get a C style string const char str env GetStringUTFChars.. Ljava lang String Ljava lang String jobject result env CallObjectMethod env obj messageMe jstr const char str env GetStringUTFChars.. an object method so I think you need to pass the object to CallObjectMethod jobject result env CallObjectMethod obj messageMe jstr What..
FindClass from any thread in Android JNI http://stackoverflow.com/questions/13263340/findclass-from-any-thread-in-android-jni that it returns jclass myFindClass JNIEnv env const char name ... jclass c0 env FindClass name jclass c1 jclass env CallObjectMethod ClassLoader MID_loadClass envNewStringUTF name dlog myFindClass s c0 p c1 p c0 and c1 are same d name c0 c1 env IsSameObject.. auto getClassLoaderMethod env GetMethodID classClass getClassLoader Ljava lang ClassLoader gClassLoader env CallObjectMethod randomClass getClassLoaderMethod gFindClassMethod env GetMethodID classLoaderClass findClass Ljava lang String Ljava lang.. lang String Ljava lang Class return JNI_VERSION_1_6 jclass findClass const char name return static_cast jclass getEnv CallObjectMethod gClassLoader gFindClassMethod getEnv NewStringUTF name JNIEnv getEnv JNIEnv env int status gJvm GetEnv void env JNI_VERSION_1_6..
Calling a java method from c++ in Android http://stackoverflow.com/questions/5198105/calling-a-java-method-from-c-in-android messageMe env GetMethodID clazz messageMe Ljava lang String V Call the method on the object jobject result env CallObjectMethod jstr messageMe Get a C style string const char str env GetStringUTFChars jstring result NULL printf s n str Clean up env.. jmethodID messageMe env GetMethodID env clazz messageMe Ljava lang String Ljava lang String jobject result env CallObjectMethod env obj messageMe jstr const char str env GetStringUTFChars env jstring result NULL should be released but what a heck it's.. jni android ndk share improve this question It's an object method so I think you need to pass the object to CallObjectMethod jobject result env CallObjectMethod obj messageMe jstr What you were doing was the equivalent of jstr.messageMe . Edit I..
|