Using Qt to make Native Android apps

In my previous blog, I talked about what characteristics made a good app for Qt in the Android environment. I’ll paraphrase an insightful response from Artem Marchenko — my blog post is really talking only about standalone apps, and not Android integrated ones. That’s correct–my blog focused on “easy wins” – areas where you could bring the Qt goodness to Android with a minimum of fuss. Of course, the “fuss” translates to a minimum of platform-specific code. And while cross-platform coding is one of the areas where I think Qt and Android make a natural combination, it’s not the only one.

Can you build Qt apps that look, feel, and act like a regular Android app? Of course you can! It’s just a little harder.

There are two things you really need. Access to the Android components (like database, multimedia, Bluetooth, etc), and a reasonable facsimile of an Android UI.

Components: On the first, the good news is that BogDan and others are working hard to extend the capabilities of the Android Qt port. While Qt 5.2 and 5.3 already have a rich set of features, Qt 5.4 and 5.5 have more planned. (The Qt on Android roadmap is something BogDan covered in our webinar, which has been archived for posterity.)

Much of the new work planned covers porting existing Qt classes to interface with the Android provided APIs. If you need access to non-Qt provided functionality, you’ll probably need to dip into JNI and call the appropriate Android Java APIs. (That topic is too deep for a 60 minute webinar, but is something that BogDan will be talking about it in depth in the hands-on Coffee & Code sessions. There are still open spots for the North American tour, but space is limited and it’s free, so register and save your seat.)

Qt Android Extras is another place for those extraneous Android APIs, but the coverage is a little sparse right now. There are some planned additions to that module too. I’ve done JNI in a past life, and I have to say that I didn’t find it the most pleasurable coding experience. I’m sure hoping things have improved since then :-)

UI: Making your Qt app look like Android: as Artem mentioned in his comment, you can build an interface with Qt Widgets which will mimic the native Android UI. There are a couple of issues with system level dialogs here or there, but mostly it should just work.

Qt Quick Controls work in Qt 5.3 and look good. But they don’t (yet) look the same as Android’s Java Controls. This is something that’s planned to be fixed for Qt 5.4.

So you’re still covered if Qt is your development tool of choice and Android is your platform of choice!

 

Share on FacebookTweet about this on TwitterShare on Google+
m4s0n501

Leave a Reply

Your email address will not be published. Required fields are marked *


five + = 8