QAndroidBinder Class
AndroidのBinderクラスの最も重要なメソッドをラップしています。詳細...
| ヘッダー: | #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 |
| ステータス: | テクノロジープレビュー |
このクラスはテクノロジープレビュー段階にあり、変更される可能性があります。
パブリック型
| enum class | CallType { Normal, OneWay } |
パブリック関数
| QAndroidBinder() | |
| QAndroidBinder(const QJniObject &binder) | |
| QJniObject | handle() const |
| virtual bool | onTransact(int code, const QAndroidParcel &data, const QAndroidParcel &reply, QAndroidBinder::CallType flags) |
| bool | transact(int code, const QAndroidParcel &data, QAndroidParcel *reply = nullptr, QAndroidBinder::CallType flags = CallType::Normal) const |
詳細な説明
QAndroidBinder は、最も重要なAndroid Binderメソッドをラップする利便性向上のためのクラスです。
メンバ型のドキュメント
enum class QAndroidBinder::CallType
この列挙型は、QAndroidBinder::transact() とともに使用され、IPC 呼び出しが実行されるモードを表します。
| 定数 | 値 | 説明 |
|---|---|---|
QAndroidBinder::CallType::Normal | 0 | 通常の IPC。呼び出し元が呼び出し先の結果を待つことを意味します。 |
QAndroidBinder::CallType::OneWay | 1 | 一方向 IPC。呼び出し元は、呼び出し先の結果を待たずに直ちに戻ります。 |
メンバ関数のドキュメント
[explicit] QAndroidBinder::QAndroidBinder()
IPCを実行するために使用できる新しいオブジェクトを作成します。
onTransact およびtransactも参照してください 。
QAndroidBinder::QAndroidBinder(const QJniObject &binder)
binder のJavaオブジェクトから新しいオブジェクトを作成します。
「transact」も参照してください 。
QJniObject QAndroidBinder::handle() const
このラッパーでは対応していない他のJava APIを呼び出す際に、戻り値が役立ちます。
[virtual] bool QAndroidBinder::onTransact(int code, const QAndroidParcel &data, const QAndroidParcel &reply, QAndroidBinder::CallType flags)
デフォルトの実装は、false を返すスタブです。ユーザーは、呼び出し元からトランザクションデータを取得するために、このメソッドをオーバーライドする必要があります。
code は実行すべきアクションです。data は呼び出し元から送信されたマーシャリング済みのデータです。
The reply is the marshaled data to be sent to the caller.
The flags are the additional operation flags.
警告:この メソッドは、このオブジェクトが作成されたスレッドとは異なる、Binderのスレッドから呼び出されます。
transactも参照してください 。
bool QAndroidBinder::transact(int code, const QAndroidParcel &data, QAndroidParcel *reply = nullptr, QAndroidBinder::CallType flags = CallType::Normal) const
IPC呼び出しを実行します
code は実行するアクションです。FIRST_CALL_TRANSACTIONとLAST_CALL_TRANSACTIONの間に指定する必要があります。
The data is the marshaled data to send to the target.
The reply (if specified) is the marshaled data to be received from the target. May be nullptr if you are not interested in the return value.
The flags are the additional operation flags.
成功した場合はtrueを返す
© 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.