1

这是我的代码,试图创建一个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吗?

4

0 回答 0