[Android-development] JNI call Intent putExtra error

ekke ekke at ekkes-corner.org
Fri Nov 24 12:02:40 CET 2017


with some help I found the solution. Instead of 

Landroid/net/URi

I had to use

Landroid/os/Parcelable



Am 20.11.17 um 08:33 schrieb ekke:
> 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
>
> _______________________________________________
> Android-development mailing list
> Android-development at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/android-development

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/android-development/attachments/20171124/04e5aa53/attachment.html>


More information about the Android-development mailing list