QAndroidActivityResultReceiver Class

用于从主 Android 活动中的 onActivityResult() 回调的接口。更多

头文件: #include <QtCore/private/qandroidextras_p.h>
CMake: find_package(Qt6 REQUIRED COMPONENTS Core)
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 是活动返回的结果,而data 要么是空,要么是类 android.content.Intent 的 Java 对象。最后两个参数都与传递给 onActivityResult() 的参数相同。

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