[Android-development] start Activity with Result - crash from JNI
ekke
ekke at ekkes-corner.org
Fri Nov 24 12:07:21 CET 2017
I'm working on an example APP HowTo open files from inside your app in
other APPs on Android / iOS.
Starting an Activity with QAndroidActivityResultReceiver:
QtAndroid::startActivity(jniIntent, requestId, this);
works well and result comes back into
handleActivityResult(int receiverRequestCode, int resultCode, const QAndroidJniObject &data)
This works well if there's an app for the Action (ACTION_VIEW,
ACTION_EDIT, ACTION_SEND) and the MimeType,
If there's no other APP found - per example ACTION_EDIT and
application/pdf and you don't have a PDF Editor,
then I'm getting my requestCode, the resultCode (0 == canceled) - so
result was sent correct to handleActivityResult()
but the APP crashes, because it seems there's no Activity created, but
JNI tries to resume
JNI DETECTED ERROR IN APPLICATION: JNI GetStaticMethodID called with pending exception android.content.ActivityNotFoundException: No Activity found to handle Intent
...
at void android.app.Instrumentation.checkStartActivityResult(int, java.lang.Object) (Instrumentation.java:1830)
art/runtime/java_vm_ext.cc:410] at android.app.Instrumentation$ActivityResult android.app.Instrumentation.execStartActivity(android.content.Context, android.os.IBinder, android.os.IBinder, android.app.Activity, android.content.Intent, int, android.os.Bundle) (Instrumentation.java:1539)
art/runtime/java_vm_ext.cc:410] at void android.app.Activity.startActivityForResult(android.content.Intent, int, android.os.Bundle) (Activity.java:4115)
art/runtime/java_vm_ext.cc:410] at void android.app.Activity.startActivityForResult(android.content.Intent, int) (Activity.java:4076)
art/runtime/java_vm_ext.cc:410]
art/runtime/java_vm_ext.cc:410] in call to GetStaticMethodID
art/runtime/java_vm_ext.cc:410] "QtThread" prio=5 tid=11 Runnable
art/runtime/java_vm_ext.cc:410] | group="main" sCount=0 dsCount=0 obj=0x1330d0a0 self=0x54523f0
art/runtime/java_vm_ext.cc:410] | sysTid=26897 nice=0 cgrp=default sched=0/0 handle=0xc9b83df0
art/runtime/java_vm_ext.cc:410] | state=R schedstat=( 0 0 0 ) utm=174 stm=11 core=5 HZ=100
art/runtime/java_vm_ext.cc:410] | stack=0xc9a87000-0xc9a89000 stackSize=1015KB
art/runtime/java_vm_ext.cc:410] | held mutexes= "mutator lock"(shared held)
...
Is there a way to avoid the crash and to catch the JNI ERROR ?
thx
ekke
More information about the Android-development
mailing list