无法使用QAndroidJniObject

时间:2015-12-03 13:01:45

标签: android c++ qt qandroidjniobject

以下是我的代码,尝试创建QAndroidJniObject来访问WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON值。

所以我这样做:

QAndroidJniObject activity = QAndroidJniObject::callStaticObjectMethod("org/qtproject/qt5/android/QtNative", "activity", "()Landroid/app/Activity;");
if ( activity.isValid() )
{
    jint keepAliveField = QAndroidJniObject::getStaticField<jint>("android/view/WindowManager/LayoutParams","FLAG_KEEP_SCREEN_ON");

    qDebug() << "keepAliveField=" << keepAliveField;
}

在我预期keepAliveField=0时会知道为什么会打印keepAliveField=128

0 个答案:

没有答案