QT JNI,callMetod 和 callStaticMetod 有什么区别
QT JNI , What is the difference between the callMetod and callStaticMetod
我可以在 java 中使用 QAndroidJniObject::callStaticMethod 作为静态方法 class.But 我不能使用 call 方法,有没有一个简单的例子。
像这样:
// get an android WallpaperManager using callStaticObjectMethod()
QAndroidJniObject activity = QtAndroid::androidActivity();
QAndroidJniObject context = activity.callObjectMethod("getApplicationContext", "()Landroid/content/Context;");
QAndroidJniObject wallpaperManager = QAndroidJniObject::callStaticObjectMethod("android/app/WallpaperManager", "getInstance", "(Landroid/content/Context;)Landroid/app/WallpaperManager;", context.object());
// get width and height
jint w = wallpaperManager.callMethod<jint>("getDesiredMinimumWidth");
jint h = wallpaperManager.callMethod<jint>("getDesiredMinimumHeight");
qDebug() << "Width:" << w << "Height:" << h;
我可以在 java 中使用 QAndroidJniObject::callStaticMethod 作为静态方法 class.But 我不能使用 call 方法,有没有一个简单的例子。
像这样:
// get an android WallpaperManager using callStaticObjectMethod()
QAndroidJniObject activity = QtAndroid::androidActivity();
QAndroidJniObject context = activity.callObjectMethod("getApplicationContext", "()Landroid/content/Context;");
QAndroidJniObject wallpaperManager = QAndroidJniObject::callStaticObjectMethod("android/app/WallpaperManager", "getInstance", "(Landroid/content/Context;)Landroid/app/WallpaperManager;", context.object());
// get width and height
jint w = wallpaperManager.callMethod<jint>("getDesiredMinimumWidth");
jint h = wallpaperManager.callMethod<jint>("getDesiredMinimumHeight");
qDebug() << "Width:" << w << "Height:" << h;