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