JNI callObject fails: Intent putExtra (ACTION_SEND)


  • Qt Champions 2016

    I'm just developing a sample APP to demonstrate HowTo VIEW or EDIT files from inside your APP in other APPs,
    then getting Response code to see if User canceled or saved the edited file.
    There are some traps - per ex. you cannot directly use files stored as APP DATA - you must copy them first to DOCUMENTS location, then when user has done his work copy this file back into your APP or only delete if user canceled.
    I'll demonstrate how such a workflow could be implemented.
    The Android part is nearly done, iOS work in progress
    APP and Blog will be published in a week or so

    Now I'm having a problem creating an Android Intent via JNI for SEND_FILE action.
    from Java this works:

    sendIntent.putExtra(Intent.EXTRA_STREAM, uri);
    

    My JNI call:

    jniIntent.callObjectMethod("putExtra", 
    	"(Ljava/lang/String;Landroid/net/Uri;)Landroid/content/Intent;", 
    		jniExtra.object<jstring>(), 
    		jniUri.object<jobject>());
    

    reports an error:
    java.lang.NoSuchMethodError: no non-static method "Landroid/content/Intent;.putExtra(Ljava/lang/String;Landroid/net/Uri;)Landroid/content/Intent;"

    another JNI call for ACTION_VIEW or ACTION_EDIT where I have to set the uri in method setDataAndType it works:

    jniIntent.callObjectMethod("setDataAndType", 
    	"(Landroid/net/Uri;Ljava/lang/String;)Landroid/content/Intent;", 
    		jniUri.object<jobject>(), 
    		jniType.object<jstring>());
    

    any idea what's wrong with my JNI Call for putExtra ?



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