Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How do I set a custom class in a java function signature?



  • Good afternoon. I try to pass a custom class to the function signature, but the debugger writes that it can't find it and the function is not executed. What am I doing wrong?
    example.java

    package ru.acnas;
    
    import java.util.ArrayList;
    
    class ADevices extends ArrayList<Integer> {
       boolean _add(int val){return add(val);}
    }
    public class Example
    {
       public void setDevices(ADevices  devices){}
    }
    

    main.cpp

    #include <QAndroidJniObject>
    #include <QAndroidJniEnvironment>
    #include <QtAndroid>
    
    int main(int argc, char *argv[])
    {
        QApplication a(argc, argv);
        QAndroidJniObject search("ru.acnas.Example")
        QAndroidJniObject test("ru.acnas.ADevices");
        search.callMethod<void>("setDevices", "(Lru.acnas.ADevices;)V", test.object());
        return a.exec();
    }
    

    debugger

    W System.err: java.lang.NoSuchMethodError: no non-static method "Lru/acnas/Example;.setDevices(Lru.acnas.ADevices;)V"
    W System.err: 	at org.qtproject.qt5.android.QtNative.startQtApplication(Native Method)
    W System.err: 	at org.qtproject.qt5.android.QtNative$7.run(QtNative.java:620)
    W System.err: 	at org.qtproject.qt5.android.QtThread$1.run(QtThread.java:61)
    W System.err: 	at java.lang.Thread.run(Thread.java:923)
    

Log in to reply