Android: Call Java function from C++



  • Hi,
    Does anybody know how can I call a Java function from C++?
    I'm using the following code, but I can't even get the java class.

    JavaVM *currVM;
    currVM = (JavaVM )QApplication::platformNativeInterface()->nativeResourceForIntegration("JavaVM");
    JNIEnv
    env;
    if( currVM->AttachCurrentThread(&env, NULL)<0){
    qCritical()<<"AttachCurrentThread failed";
    }
    jclass applicationClass=env->FindClass("com/test/QtApplication");
    //applicationClass==null



  • This example: http://community.kde.org/Necessitas/JNI
    show how to call Java methods from C++ using Qt.


Log in to reply
 

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