Obsolete Members for QJniEnvironment

The following members of class QJniEnvironment are deprecated. They are provided to keep old source code working. We strongly advise against using them in new code.

Public Functions

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

Member Function Documentation

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.

This is an overloaded function.

Use the overload with a const JNINativeMethod[] instead.

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

Returns 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);

© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.