Obsolete Members for QJniEnvironment

以下成员源于类 QJniEnvironment 被弃用。 提供它们是为使旧源代码能继续工作。强烈建议不要在新代码中使用它们。

公共函数

(deprecated (6.2)) bool registerNativeMethods (const char * className , JNINativeMethod [] methods , int size )

成员函数文档编制

bool QJniEnvironment:: registerNativeMethods (const char * className , JNINativeMethod [] methods , int size )

This function is deprecated since 6.2. We strongly advise against using it in new code.

这是重载函数。

Use the overload with a const JNINativeMethod[] instead.

Registers the Java methods in the array methods 的大小 size , each of which can call native C++ functions from class className . These methods must be registered before any attempt to call them.

返回 true if the registration is successful, otherwise false .

Each element in the methods array consists of:

  • The Java method name
  • Method signature
  • The C++ functions that will be executed
JNINativeMethod methods[] = {{"callNativeOne", "(I)V", reinterpret_cast<void *>(fromJavaOne)},
                             {"callNativeTwo", "(I)V", reinterpret_cast<void *>(fromJavaTwo)}};
QJniEnvironment env;
env.registerNativeMethods("org/qtproject/android/TestJavaClass", methods, 2);