If you’re a regular Qt user (like me) and have tried writing Android applications with Qt then you must have come across situations where you’ve needed some very simple capabilities of Android API but it wasn’t present in the Qt library. Displaying a Toast message in Qt for Android is one of those situations. In this post I’m going to describe how to display Toast messages in Qt for Android, and it’s also a very good example of showing how to use JNI (QAndroidJniObject class in Qt, along with Java code) to access Java code from within C++/Qt code.
Continue reading “How to Show a Toast Message in Qt for Android”How to Access Android Camera Using Qt/C++
In this article I am going to describe the required steps needed for accessing Android Camera (or Default Camera Interface) using Qt. Unfortunately OpenCV does not provide a reliable way of connecting to Camera in Android so you have go for a method like this if you intend to write an Android application which uses OpenCV and Qt together. I strongly recommend that you should first read this article (which describes how to access Android Gallery from Qt) and also this article (which shows how to mix Java and C++ code in Qt) and then return here because I will be assuming that you are familiar with those processes. So if you can already access Android Gallery using Qt then continue reading the steps described below.
Continue reading “How to Access Android Camera Using Qt/C++”How to Open Android Image Gallery in Qt
This article describes how to open default Android Gallery in Qt using a mixture of Android’ Java and Qt (C++) code. It is specially useful if you are working with images, for example if you want to open a Mat Image in OpenCV using imread function or if you are just writing some kind of image viewer program. Unfortunately Qt does not offer this (yet) by default so I thought I could share it with you.
Continue reading “How to Open Android Image Gallery in Qt”How To Mix C++ And Java Code (In Qt For Android)
Qt allows you to use Java code in your Android applications. This is the same code that Android Studio (or Eclipse etc.) users use when they are writing applications for Android. In Qt, by default, you are limited to C++ code and what the Qt modules have to offer (which in most cases are enough) but there are certain situations where you need to use something from Android API which is not provided in Qt. An obvious example for this can be using the default Android Galley to open a picture, or using Text-To-Speech engine or any other API that you can think of. If you don’t want to be limited to what is provided by Qt while writing Android apps then follow the steps below to be able to add Java code to your Qt project.
Continue reading “How To Mix C++ And Java Code (In Qt For Android)”OpenCV + Qt + Android, Adding Required Libraries and Includes
Another note to myself which I hope will be useful for others searching it.
Add the following lines to your PRO file in Qt, or create a PRI file using the following and include that in your PRO file.
Continue reading “OpenCV + Qt + Android, Adding Required Libraries and Includes”Extending your Qt Android application using JNI
Following slides contain valuable information on Qt, Android and JNI that were presented during Qt Developer Days 2014.
How to call a Java function using C++ (Qt) and how to call-back a C++ (Qt) function using Java are described here.
Extending your Qt Android application using JNI
They’re originally taken from http://www.qtdeveloperdays.com