MCPcopy Create free account
hub / github.com/android/ndk-samples / CallIntMethod

Method CallIntMethod

teapots/common/ndk_helper/JNIHelper.cpp:678–702  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

676}
677
678int32_t JNIHelper::CallIntMethod(jobject object, const char* strMethodName,
679 const char* strSignature, ...) {
680 int32_t i = 0;
681 if (activity_ == NULL) {
682 LOGI(
683 "JNIHelper has not been initialized. Call init() to initialize the "
684 "helper");
685 return i;
686 }
687
688 JNIEnv* env = AttachCurrentThread();
689 jclass cls = env->GetObjectClass(object);
690 jmethodID mid = env->GetMethodID(cls, strMethodName, strSignature);
691 if (mid == NULL) {
692 LOGI("method ID %s, '%s' not found", strMethodName, strSignature);
693 return i;
694 }
695 va_list args;
696 va_start(args, strSignature);
697 i = env->CallIntMethodV(object, mid, args);
698 va_end(args);
699
700 env->DeleteLocalRef(cls);
701 return i;
702}
703
704bool JNIHelper::CallBooleanMethod(jobject object, const char* strMethodName,
705 const char* strSignature, ...) {

Callers 3

GetDisplayRotationMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected