Recently I use qt to write a android app.
But I have a big question, can I use/call some native android APIS, such as call special activity?
e.g, In Android SDK I call contacts in java:
Intent intent = new Intent(Intent.ACTION_PICK,ContactsContract.Contacts.CONTENT_URI);
startActivityForResult(intent, PICK_CONTACT);
Is there a some c++ wrapper libraries for java android sdk APIs?
Or if I need a some special component (that has written with java), can I have it in my qt android program?
Or make a program with mixed pages/activities of "pure qt" and "standard java" or "C++ android NDK" ?
(I ask this question because I have a experience with MOSYNC framework, that was a good one but you have been limited to its own libraries, you couldn't use any external libraries or android standard APIs, ...)
Thanks in advance.
EDIT: according to improvements in JNI ( http://qt-project.org/doc/qt-5/qtandroidextras-index.html), I have a question: can I use 'any' android Java third-party libraries in my qt project? As I use those libraries in Java SDK projects?
The native modifier indicates that a method is implemented in platform-dependent code, often seen in C language. Native modifier indicates that a method is implemented in platform-dependent code, often in C.
A Java method is generically a code block with a name that you can write using plain java. A native method is a method that is linked to a native library.
In order to do what you want, you need to call Java code from your C++ code, through JNI. I don't know any C++ wrapper libraries for this. You will need to get the Java VM from JNI_OnLoad, and when you want to call a Java method you will need to attach the VM to your thread, with gives you a JNIEnv, which you can use to find the class you want and call methods on it. This link should help with the details.
As to whether it is worth it to use QT to develop Android applications, yes, if you need cross-platform support and want to deploy the same application to Android, Linux, Windows, etc. If you are only developing Android apps, then in my experience it is easier and faster to use Android directly.
I am not sure how you are proceeding with "Qt for Android". But at this point of time, this idea is officially supported by the KDE team (K Desktop Environment). They call it KDE Necessitas project. And they have released the first beta of this project on October 2012.
So basically when you install the Necessitas SDK, you probably get these things installed.
Using the customized Qt Creator, you can
One major concern I have with Qt for Android is regarding the UI. The UI have the native look and feel of KDE 4.x (The same which runs on desktops). The android UI themes (Holo etc.) are not fully available yet.
And since this project is still beta, I am not sure about the availability of wrapper classes/functions for the Android native features. Please go through the official documentation for more details.
Hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With