本页内容

QAndroidActivityResultReceiver Class

用于 Android 主 Activity 中 onActivityResult() 回调的接口。更多内容...

头文件: #include <QtCore/private/qandroidextras_p.h>
CMake: find_package(Qt6 REQUIRED COMPONENTS CorePrivate)
target_link_libraries(mytarget PRIVATE Qt6::CorePrivate)
qmake: QT += core-private
自: Qt 6.2
状态: 技术预览

该类处于技术预览阶段,内容可能会有变动。

公共函数

virtual void handleActivityResult(int receiverRequestCode, int resultCode, const QJniObject &data) = 0

详细说明

创建该类的子类,以便在使用QtAndroidPrivate::startActivity() 和QtAndroidPrivate::startIntentSender() API时收到结果通知。

成员函数文档

[pure virtual] void QAndroidActivityResultReceiver::handleActivityResult(int receiverRequestCode, int resultCode, const QJniObject &data)

重写此方法,以便在使用QtAndroidPrivate::startActivity()或QtAndroidPrivate::startIntentSender()启动活动后获取活动结果。receiverRequestCode 是该接收器的唯一请求代码,该代码最初被传递给了startActivity()或startIntentSender()函数。resultCode 是 Activity 返回的结果,而data 要么为 null,要么是 android.content.Intent 类的 Java 对象。最后两个参数与传递给 onActivityResult() 的参数完全相同。

© 2026 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.