I know that using the following method, I could get a string from the Android main activity to Qt/C++ side.
QAndroidJniObject my_string = QtAndroid::androidActivity().callObjectMethod<jstring>("someMethod");
QString my_qsrting = my_string.toString();
Above is great if someMethod
returns a Java String
. But what if someMethod
returns an int? Following way does not work in Qt? It has compilation errors.
QAndroidJniObject my_int = QtAndroid::androidActivity().callObjectMethod<jint>("someMethod");
How can I collect an int
or a jint
using QtAndroid::androidActivity().callObjectMethod
?
Going through this link, I could not find the answer to my question.
Qt version:
Qt 5.12 commercial version
You don't use
callObjectMethod
for methods that return primitives; you usecallMethod
for that: