Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Qt 5.4/Android: Call Qt method from Java code
Qt 6.11 is out! See what's new in the release blog

Qt 5.4/Android: Call Qt method from Java code

Scheduled Pinned Locked Moved Mobile and Embedded
3 Posts 2 Posters 1.8k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    lynic
    wrote on last edited by
    #1

    Hi,

    Is there a way to call a C++/Qt object method from Java? I want to notfiy (with a list of parameter arguements) my Qt/Qml code from a Java activity. Do I need to register the C++ class as a listener? How can this be achieved?

    Regards,

    1 Reply Last reply
    0
    • L Offline
      L Offline
      lynic
      wrote on last edited by
      #2

      Solved it: you just have to add a native method to Java and implement it somewhere in C++.

      1 Reply Last reply
      0
      • benlauB Offline
        benlauB Offline
        benlau
        Qt Champions 2016
        wrote on last edited by
        #3

        You need to register your C++ interface via JNI. You may find example code at:

        https://github.com/benlau/qtandroidexamplecode/tree/master/qtandroidrunner

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved