0

我正在开发显示从特定文件夹到 gridview 的图像列表的应用程序。它在所有设备上都运行良好,但在我尝试在 nexus 7" 平板电脑上测试它时崩溃了。

以下是我得到的崩溃日志。

05-05 10:54:02.478  4246  4246 W Bundle  : Key android.intent.extra.TEXT expected ArrayList<CharSequence> but value was a java.lang.String.  The default value <null> was returned.
05-05 10:54:02.488  4246  4246 W Bundle  : Attempt to cast generated internal exception:
05-05 10:54:02.488  4246  4246 W Bundle  : java.lang.ClassCastException: java.lang.String cannot be cast to java.util.ArrayList
05-05 10:54:02.488  4246  4246 W Bundle  :  at android.os.Bundle.getCharSequenceArrayList(Bundle.java:1334)
05-05 10:54:02.488  4246  4246 W Bundle  :  at android.content.Intent.getCharSequenceArrayListExtra(Intent.java:4414)
05-05 10:54:02.488  4246  4246 W Bundle  :  at android.content.Intent.migrateExtraStreamToClipData(Intent.java:6872)
05-05 10:54:02.488  4246  4246 W Bundle  :  at android.content.Intent.migrateExtraStreamToClipData(Intent.java:6840)
05-05 10:54:02.488  4246  4246 W Bundle  :  at android.app.Instrumentation.execStartActivity(Instrumentation.java:1411)
05-05 10:54:02.488  4246  4246 W Bundle  :  at android.app.Activity.startActivityForResult(Activity.java:3370)
05-05 10:54:02.488  4246  4246 W Bundle  :  at android.app.Activity.startActivityForResult(Activity.java:3331)
05-05 10:54:02.488  4246  4246 W Bundle  :  at android.app.Activity.startActivity(Activity.java:3566)
05-05 10:54:02.488  4246  4246 W Bundle  :  at android.app.Activity.startActivity(Activity.java:3534)
05-05 10:54:02.488  4246  4246 W Bundle  :  at com.mxtech.logcollector.ActivityCollector.collectAndSend(ActivityCollector.java:354)
05-05 10:54:02.488  4246  4246 W Bundle  :  at com.mxtech.logcollector.ActivityCollector.onClick(ActivityCollector.java:364)
05-05 10:54:02.488  4246  4246 W Bundle  :  at com.android.internal.app.AlertController$ButtonHandler.handleMessage(AlertController.java:166)
05-05 10:54:02.488  4246  4246 W Bundle  :  at android.os.Handler.dispatchMessage(Handler.java:99)
05-05 10:54:02.488  4246  4246 W Bundle  :  at android.os.Looper.loop(Looper.java:137)
05-05 10:54:02.488  4246  4246 W Bundle  :  at android.app.ActivityThread.main(ActivityThread.java:5041)
05-05 10:54:02.488  4246  4246 W Bundle  :  at java.lang.reflect.Method.invokeNative(Native Method)
05-05 10:54:02.488  4246  4246 W Bundle  :  at java.lang.reflect.Method.invoke(Method.java:511)
05-05 10:54:02.488  4246  4246 W Bundle  :  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
05-05 10:54:02.488  4246  4246 W Bundle  :  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
05-05 10:54:02.488  4246  4246 W Bundle  :  at dalvik.system.NativeStart.main(Native Method)
4

1 回答 1

0

进行强制转换为 NULL 时,看起来像一些自动装箱问题。尝试使用默认值!

于 2013-05-06T09:35:06.937 回答