当我在android 4.1中发送大小超过20的HashMap时,我崩溃了

时间:2012-10-02 13:23:50

标签: android

当我在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();

2 个答案:

答案 0 :(得分:2)

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

this问题的回答也应该有所帮助

答案 1 :(得分:0)

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