Call C++ slot from Java

  • Hi everyone!
    I was working with my Android application and I trying to get NMEA messages from GPS.
    Up to now:

    1. I wrote java code to implement an NmeaListener and call a native function every time that a message is received.
    2. I wrote an Android GPS class (just in case that I want to integrate more GPS sources) that define my native function.
    3. What is still missing is that I want to emit a signal or call a slot from this class but I cannot understand how should I do that. I found here a post from stackoverflow that is trying to do the same thing but I get a compile error
      cannot call member function 'GpsAndroid GpsAndroid::instance()' without object*

    Could you help me with this? Is there an easy way to call a slot or emit a signal from Java?


  • I found this repo that has helped me a lot. I could make what I wanted to do!

  • Using static C++ methods with the JNI registration interface works better for me:

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.