Results 1 to 1 of 1

Thread: How to attach user-written java class to project and how to subclass QtActivity?

  1. #1
    Join Date
    Sep 2013
    Posts
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows Android

    Default How to attach user-written java class to project and how to subclass QtActivity?

    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 Code:
    1. QT += androidextras
    2. ANDROID_PACKAGE_SOURCE_DIR = $$PWD/myandroidsrc
    To copy to clipboard, switch view to plain text mode 
    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.

  2. The following user says thank you to Leonid.cpp for this useful post:


Similar Threads

  1. Get pointer to class written in the script
    By Jonny174 in forum Qt Programming
    Replies: 1
    Last Post: 24th July 2013, 16:56
  2. Replies: 10
    Last Post: 7th January 2013, 12:15
  3. QMake Call a pre-written makefile from a SUBDIRS project
    By Mookie in forum Qt Tools
    Replies: 0
    Last Post: 12th December 2011, 15:05
  4. Open a QT project (written on pc) in a QT macOSX
    By Mikele di Sagitter in forum Qt Programming
    Replies: 7
    Last Post: 7th January 2011, 01:50
  5. is there a class in QT4 like robot class of java
    By sathyanarayanan in forum Qt Programming
    Replies: 1
    Last Post: 18th February 2009, 12:25

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.