Considering this Java class with the static method:
public class TestClass{
public string str;
public TestClass() {
str = "Test From Java";
}
public static String staticMethod() {
return "Test From Java";
}
}
I have written these lines of code in c++ file:
QAndroidJniObject str = QAndroidJniObject::callStaticObjectMethod(
"org/.../TestClass"
,"staticMethod"
,"(V)Ljava/lang/String;");
It seems everything is working but I don't know how can I use the str
Object. I tried to convert it to a QString
object using str.tostring()
method but it always returns an empty string.
Why it does not work as expected? I've also tested ()Ljava/lang/String;
for method signature but no success!
Thanks in advance.