On Fri, Apr 13, 2012 at 3:29 PM, Deepwinter <[email protected]>wrote:

> It's large because it's a JSON document containing a JPEG file.


*thud*

Don't do that.

Don't put a Bitmap of any significant size in the extras.  So definitely
don't put it in there encoded as a JSON array.  If the image is so large
that it is causing you this problem in a JSON array, it is probably so
large that you shouldn't be copying it even via Parcelable.

The extras are not there for you to stuff large amount of data.  Those need
to be copied from your process to a system process, held in the system
process as long as the user could ever return to the newly launching
activity, and copied back to the process running the new activity.  And
copied into that process every time the activity gets recreated.

If you are putting more than 10s of K of data in there, you really need to
stop and do something else.

Plus there are significant limits on the amount of data allowed to go
through IPC calls, so if you stuff a lot of data in there you have a good
chance of hitting those limits and falling on your face.

Big data should go into storage.  Read the file when you need it.  If you
need to transfer it between apps, put it behind a content provider (which
the other app can open a stream on to read the data).

-- 
Dianne Hackborn
Android framework engineer
[email protected]

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to