[Android-development] JNI call Intent putExtra error

ekke ekke at ekkes-corner.org
Mon Nov 20 08:33:19 CET 2017


Just working on an example App to demo HowTo open / share files from
inside the Qt App in other Apps on Android and iOS.

Intents with ACTION_VIEW and ACTION_EDIT are working well.

But I’m having a problem creating an Intent from JNI for SEND_FILE action.

>From Android Java this works:

sendIntent.putExtra(Intent.EXTRA_STREAM, uri);

My JNI call

intent.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:

intent.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 ?

thx

ekke




More information about the Android-development mailing list