How do I return bool from Android Java code?
Unsolved
Mobile and Embedded
-
I'm new to Android and JNI stuff, I basically need to return a boolean from some android java code,
Now looking at an example I can get a string to return but not sure how to go about returning a bool
Currently have test.java:
import org.qtproject.qt5.android.bindings.QtApplication; import org.qtproject.qt5.android.bindings.QtActivity; import android.content.res.Configuration; public class test extends QtActivity { public static String printBob(int a) { return "hello bob"; } public boolean teste(){ Configuration config = getResources().getConfiguration(); return config.isScreenRound(); }; }
Now the printBob() works fine from:
QAndroidJniObject str = QAndroidJniObject::callStaticObjectMethod("test", "printBob", "(I)Ljava/lang/String;" ); return str.toString();
But I'm not sure how to call the teste() function to return the bool
Thanks
-
-
@koahnig I read that initially, the signature for string is of course
(I)Ljava/lang/String;
I get that bit, but whatever i put in the last argument fails, I'm new to this stuff it doesn't really make sense
QAndroidJniObject str = QAndroidJniObject::callStaticObjectMethod("test", "teste", "(I)Z");
-
@Allstar12345 You have to use full name, with package.
For example if your class test is in packagecom.mycompany.application
:QAndroidJniObject str = QAndroidJniObject::callStaticObjectMethod("com/mycompany/application/test", "teste", "(I)Z");