Obsolete Members for QJniEnvironment

以下成員源於類 QJniEnvironment 被棄用。 提供它們是為使舊源代碼能繼續工作。強烈建議不要在新代碼中使用它們。

公共函數

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

成員函數文檔編製

[deprecated in 6.2] 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);