1

当我在 android 4.1 中发送大小超过 20 的 HashMap 时,我会因以下日志而崩溃:

10-02 13:13:05.068: ERROR/AndroidRuntime(938): FATAL EXCEPTION: main
        java.lang.SecurityException: Unable to find app for caller android.app.ApplicationThreadProxy@41bbb490 (pid=938) when publishing content providers
        at android.os.Parcel.readException(Parcel.java:1425)
        at android.os.Parcel.readException(Parcel.java:1379)
        at android.app.ActivityManagerProxy.publishContentProviders(ActivityManagerNative.java:2392)
        at android.app.ActivityThread.installContentProviders(ActivityThread.java:4199)
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4132)
        at android.app.ActivityThread.access$1300(ActivityThread.java:130)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1255)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:137)
        at android.app.ActivityThread.main(ActivityThread.java:4745)
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:511)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
        at dalvik.system.NativeStart.main(Native Method)

我为此做了什么:

Intent intent = new Intent(MyActions.PREVIEWS);
HashMap<String, Bitmap> thumbnails = new HashMap<String, Bitmap>();
// added more than 20 items
intent.putExtra("previews", thumbnails);
setResult(RESULT_OK, intent);
finish();
4

2 回答 2

2

您应该将Bitmaps 保存到文件中并将它们的引用传递给另一个活动。Extra 的捆绑包大小有限制:https ://groups.google.com/forum/?fromgroups=#!topic/android-developers/kwmTGz8GAoQ

回答这个问题也应该有帮助

于 2012-10-02T13:41:23.810 回答
0

您可能超出了可以在 Intent 中发送的数据量

于 2012-10-02T13:31:38.593 回答