<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[How do I return bool from Android Java code?]]></title><description><![CDATA[<p dir="auto">I'm new to Android and JNI stuff, I basically need to return a boolean from some android java code,</p>
<p dir="auto">Now looking at an example I can get a string to return but not sure how to go about returning a bool</p>
<p dir="auto">Currently have test.java:</p>
<pre><code>    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();

    };

    }

</code></pre>
<p dir="auto">Now the printBob() works fine from:</p>
<pre><code>QAndroidJniObject str = QAndroidJniObject::callStaticObjectMethod("test",
                                       "printBob",
                                       "(I)Ljava/lang/String;"
                                       );

    return str.toString();
</code></pre>
<p dir="auto">But I'm not sure how to call the teste() function to return the bool</p>
<p dir="auto">Thanks</p>
]]></description><link>https://forum.qt.io/topic/113977/how-do-i-return-bool-from-android-java-code</link><generator>RSS for Node</generator><lastBuildDate>Mon, 08 Jun 2026 01:59:19 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/113977.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 23 Apr 2020 14:20:02 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to How do I return bool from Android Java code? on Thu, 23 Apr 2020 21:50:22 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/allstar12345">@<bdi>Allstar12345</bdi></a> You have to use full name, with package.<br />
For example if your class test is in package <code>com.mycompany.application</code>:</p>
<pre><code> QAndroidJniObject str = QAndroidJniObject::callStaticObjectMethod("com/mycompany/application/test",
                                           "teste",
                                           "(I)Z");
</code></pre>
]]></description><link>https://forum.qt.io/post/590486</link><guid isPermaLink="true">https://forum.qt.io/post/590486</guid><dc:creator><![CDATA[KroMignon]]></dc:creator><pubDate>Thu, 23 Apr 2020 21:50:22 GMT</pubDate></item><item><title><![CDATA[Reply to How do I return bool from Android Java code? on Thu, 23 Apr 2020 20:06:03 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/koahnig">@<bdi>koahnig</bdi></a> I read that initially, the signature for string is of course</p>
<pre><code>(I)Ljava/lang/String;
</code></pre>
<p dir="auto">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</p>
<pre><code>
    QAndroidJniObject str = QAndroidJniObject::callStaticObjectMethod("test",
                                           "teste",
                                           "(I)Z");
</code></pre>
]]></description><link>https://forum.qt.io/post/590468</link><guid isPermaLink="true">https://forum.qt.io/post/590468</guid><dc:creator><![CDATA[Allstar12345]]></dc:creator><pubDate>Thu, 23 Apr 2020 20:06:03 GMT</pubDate></item><item><title><![CDATA[Reply to How do I return bool from Android Java code? on Thu, 23 Apr 2020 16:39:16 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/allstar12345">@<bdi>Allstar12345</bdi></a></p>
<p dir="auto">Under <a href="https://doc.qt.io/qt-5/qandroidjniobject.html#details" target="_blank" rel="noopener noreferrer nofollow ugc">https://doc.qt.io/qt-5/qandroidjniobject.html#details</a></p>
<p dir="auto"><img src="https://ddgobkiprc33d.cloudfront.net/bb39a9ca-a46c-4b7b-bb9e-ae40d5a7946e.png" alt="9c6ea555-f303-464c-b09f-600b65b31c02-image.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://forum.qt.io/post/590411</link><guid isPermaLink="true">https://forum.qt.io/post/590411</guid><dc:creator><![CDATA[koahnig]]></dc:creator><pubDate>Thu, 23 Apr 2020 16:39:16 GMT</pubDate></item></channel></rss>