java.lang.ClassCastException: android.net.Uri$StringUri cannot be cast to java.util.ArrayList

Appcelerator JIRA | Shuo Liang | 1 year ago
  1. 0

    h6.Feature: Right Now, `Ti.Android.Intent` only gives the option to send a single url within the `putExtraUri()` function. We need the option to use the `ACTION_SEND_MULTIPLE` instead of `ACTION_SEND` constant in order to allow an Array of URLs to be passed instead of a single String value. h6.Usage example: {code} var photos = [ firstImage.nativePath, secondImage.nativePath ]; intent.putExtraUri(Ti.Android.EXTRA_STREAM, photos); {code} h6.Expected Result: success intent call h6.Actual Result: Right now it generates an exception: {code} [WARN] Bundle: Key android.intent.extra.STREAM expected ArrayList but value was a android.net.Uri$StringUri. The default value <null> was returned. [WARN] Bundle: Attempt to cast generated internal exception: [WARN] Bundle: java.lang.ClassCastException: android.net.Uri$StringUri cannot be cast to java.util.ArrayList [WARN] Bundle: at android.os.Bundle.getParcelableArrayList(Bundle.java:805) [WARN] Bundle: at android.content.Intent.getParcelableArrayListExtra(Intent.java:5116) [WARN] Bundle: at android.content.Intent.migrateExtraStreamToClipData(Intent.java:7852) [WARN] Bundle: at android.app.Instrumentation.execStartActivity(Instrumentation.java:1494) [WARN] Bundle: at android.app.Activity.startActivityForResult(Activity.java:3745) [WARN] Bundle: at android.app.Activity.startActivityForResult(Activity.java:3706) [WARN] Bundle: at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:817) [WARN] Bundle: at android.app.Activity.startActivity(Activity.java:4016) [WARN] Bundle: at android.app.Activity.startActivity(Activity.java:3984) [WARN] Bundle: at org.appcelerator.titanium.proxy.ActivityProxy.startActivity(ActivityProxy.java:110) [WARN] Bundle: at org.appcelerator.kroll.runtime.v8.V8Function.nativeInvoke(Native Method) [WARN] Bundle: at org.appcelerator.kroll.runtime.v8.V8Function.callSync(V8Function.java:57) [WARN] Bundle: at org.appcelerator.kroll.runtime.v8.V8Function.call(V8Function.java:43) [WARN] Bundle: at ti.modules.titanium.TitaniumModule$Timer.run(TitaniumModule.java:152) [WARN] Bundle: at android.os.Handler.handleCallback(Handler.java:739) [WARN] Bundle: at android.os.Handler.dispatchMessage(Handler.java:95) [WARN] Bundle: at android.os.Looper.loop(Looper.java:135) [WARN] Bundle: at org.appcelerator.kroll.KrollRuntime$KrollRuntimeThread.run(KrollRuntime.java:112) {code}

    Appcelerator JIRA | 1 year ago | Shuo Liang
    java.lang.ClassCastException: android.net.Uri$StringUri cannot be cast to java.util.ArrayList
  2. 0

    h6.Feature: Right Now, `Ti.Android.Intent` only gives the option to send a single url within the `putExtraUri()` function. We need the option to use the `ACTION_SEND_MULTIPLE` instead of `ACTION_SEND` constant in order to allow an Array of URLs to be passed instead of a single String value. h6.Usage example: {code} var photos = [ firstImage.nativePath, secondImage.nativePath ]; intent.putExtraUri(Ti.Android.EXTRA_STREAM, photos); {code} h6.Expected Result: success intent call h6.Actual Result: Right now it generates an exception: {code} [WARN] Bundle: Key android.intent.extra.STREAM expected ArrayList but value was a android.net.Uri$StringUri. The default value <null> was returned. [WARN] Bundle: Attempt to cast generated internal exception: [WARN] Bundle: java.lang.ClassCastException: android.net.Uri$StringUri cannot be cast to java.util.ArrayList [WARN] Bundle: at android.os.Bundle.getParcelableArrayList(Bundle.java:805) [WARN] Bundle: at android.content.Intent.getParcelableArrayListExtra(Intent.java:5116) [WARN] Bundle: at android.content.Intent.migrateExtraStreamToClipData(Intent.java:7852) [WARN] Bundle: at android.app.Instrumentation.execStartActivity(Instrumentation.java:1494) [WARN] Bundle: at android.app.Activity.startActivityForResult(Activity.java:3745) [WARN] Bundle: at android.app.Activity.startActivityForResult(Activity.java:3706) [WARN] Bundle: at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:817) [WARN] Bundle: at android.app.Activity.startActivity(Activity.java:4016) [WARN] Bundle: at android.app.Activity.startActivity(Activity.java:3984) [WARN] Bundle: at org.appcelerator.titanium.proxy.ActivityProxy.startActivity(ActivityProxy.java:110) [WARN] Bundle: at org.appcelerator.kroll.runtime.v8.V8Function.nativeInvoke(Native Method) [WARN] Bundle: at org.appcelerator.kroll.runtime.v8.V8Function.callSync(V8Function.java:57) [WARN] Bundle: at org.appcelerator.kroll.runtime.v8.V8Function.call(V8Function.java:43) [WARN] Bundle: at ti.modules.titanium.TitaniumModule$Timer.run(TitaniumModule.java:152) [WARN] Bundle: at android.os.Handler.handleCallback(Handler.java:739) [WARN] Bundle: at android.os.Handler.dispatchMessage(Handler.java:95) [WARN] Bundle: at android.os.Looper.loop(Looper.java:135) [WARN] Bundle: at org.appcelerator.kroll.KrollRuntime$KrollRuntimeThread.run(KrollRuntime.java:112) {code}

    Appcelerator JIRA | 1 year ago | Shuo Liang
    java.lang.ClassCastException: android.net.Uri$StringUri cannot be cast to java.util.ArrayList
  3. Speed up your debug routine!

    Automated exception search integrated into your IDE

Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. java.lang.ClassCastException

    android.net.Uri$StringUri cannot be cast to java.util.ArrayList

    at android.os.Bundle.getParcelableArrayList()
  2. Android Platform
    Activity.startActivityForResult
    1. android.os.Bundle.getParcelableArrayList(Bundle.java:805)
    2. android.content.Intent.getParcelableArrayListExtra(Intent.java:5116)
    3. android.content.Intent.migrateExtraStreamToClipData(Intent.java:7852)
    4. android.app.Instrumentation.execStartActivity(Instrumentation.java:1494)
    5. android.app.Activity.startActivityForResult(Activity.java:3745)
    6. android.app.Activity.startActivityForResult(Activity.java:3706)
    6 frames
  3. Android Support v4
    FragmentActivity.startActivityForResult
    1. android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:817)
    1 frame
  4. Android Platform
    Activity.startActivity
    1. android.app.Activity.startActivity(Activity.java:4016)
    2. android.app.Activity.startActivity(Activity.java:3984)
    2 frames
  5. org.appcelerator.titanium
    ActivityProxy.startActivity
    1. org.appcelerator.titanium.proxy.ActivityProxy.startActivity(ActivityProxy.java:110)
    1 frame
  6. org.appcelerator.kroll
    V8Function.call
    1. org.appcelerator.kroll.runtime.v8.V8Function.nativeInvoke(Native Method)
    2. org.appcelerator.kroll.runtime.v8.V8Function.callSync(V8Function.java:57)
    3. org.appcelerator.kroll.runtime.v8.V8Function.call(V8Function.java:43)
    3 frames
  7. ti.modules.titanium
    TitaniumModule$Timer.run
    1. ti.modules.titanium.TitaniumModule$Timer.run(TitaniumModule.java:152)
    1 frame
  8. Android Platform
    Looper.loop
    1. android.os.Handler.handleCallback(Handler.java:739)
    2. android.os.Handler.dispatchMessage(Handler.java:95)
    3. android.os.Looper.loop(Looper.java:135)
    3 frames
  9. org.appcelerator.kroll
    KrollRuntime$KrollRuntimeThread.run
    1. org.appcelerator.kroll.KrollRuntime$KrollRuntimeThread.run(KrollRuntime.java:112)
    1 frame