Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-70284

QAndroidIntent crashes when creating from QAndroidJniObject

    XMLWordPrintable

    Details

    • Platform/s:
      Android
    • Commits:
      f7df383a284e2189f0137efd9d9496f2be79566b

      Description

      When getting the Intent from an Activity, and trying to create an QAndroidIntent from the corresponding QAndroidJniObject, my application crashes with an "JNI DETECTED ERROR IN APPLICATION: jarray was NULL" error. 

      Source:

      QAndroidJniObject activityObj = QtAndroid::androidActivity();
          QAndroidJniObject intentObj = activityObj.callObjectMethod("getIntent", "()Landroid/content/Intent;");
          if (intentObj.isValid()) {
              QAndroidIntent startupIntent(intentObj); // crashes here
              QVariant val = startupIntent.extraVariant("MyStartupValue");
          }
      
      

      Getting Intent extras by jni calls instead works fine:

      QAndroidJniObject extrasObj = intentObj.callObjectMethod("getStringExtra", "(Ljava/lang/String;)Ljava/lang/String;", QAndroidJniObject::fromString(name).object<jstring>());
      

        Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            andysh Andy Shaw
            Reporter:
            tobiasdruener Tobias Drüner
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes