PDA

View Full Version : How to attach user-written java class to project and how to subclass QtActivity?



Leonid.cpp
16th December 2013, 10:27
Hello.
I am using Qt 5.2 for Android. I have an application that uses some specific functions written on Java. In Qt 5.1, there was QtActivity.java file, which was created automatically by Qt Creator IDE. So, I just modified its contents and used JNI for calling functions from C++ code. In Qt 5.2, this file is not a part of a project anymore, building project erases any changes in this file.

Is there any way to force android to use my own subclass of QtActivity instead of the QtActivity itself?
And how to attach user-written java class to a project?

I've created MyActivity.java file in myproject/myandroidsrc folder and added these lines into my .pro file:

QT += androidextras
ANDROID_PACKAGE_SOURCE_DIR = $$PWD/myandroidsrc
I have tried to use QAndroidJniObject, but there is always an error occurs: Invalid indirect reference someHexNumberHere in decodeIndirectRef.
Any help is appreciated.

P. S. Sorry, I am not good in Java and English.