I have to write some Android platform specific code in Qt and need to use JNI. I have a problem with how to create an array of some object. In this case I want to construct an array of strings from C++.
In the two code snippets below the first one creates a java string and it works as expected. In the second code snippet I want to create a java string array, but I get the debug message: "Java string array not valid" so I assume the signature and/or parameters passed to the "QAndroidJniObject javaStringArray()" function is not correct.
I have been looking at the documentation, but was not able to find or properly understand how to do this.
I assume I have to send in the size of the java string array object I want to construct as well.
Any help is appreciated!
QAndroidJniObject javaString("java/lang/String");
if (!javaString.isValid()) {
qDebug() << "Java string not valid";
return false;
}
QAndroidJniObject javaStringArray("[Ljava/lang/String;");
if (!javaStringArray.isValid()) {
qDebug() << "Java string array not valid";
return false;
}