Interesting. In case this Android bug/feature not only applies to
input streams, this might also explain why I no longer had memory
related crashes on the G1 after recently switching to using
BitmapFactory.decodeResource(getResources() instead of getResources
().getDrawable() to retrieve background images from my resources.

Regards

On Nov 12, 5:30 am, Romain Guy <[EMAIL PROTECTED]> wrote:
> This is a known bug. Here is a workaround:
>
>                     in = new BufferedInputStream(new
> URL(getUrl(size)).openStream(),
>                             IO_BUFFER_SIZE);
>
>                     final ByteArrayOutputStream dataStream = new
> ByteArrayOutputStream();
>                     out = new BufferedOutputStream(dataStream, 
> IO_BUFFER_SIZE);
>                     copy(in, out);
>                     out.flush();
>
>                     final byte[] data = dataStream.toByteArray();
>                     bitmap = BitmapFactory.decodeByteArray(data, 0,
> data.length);

--~--~---------~--~----~------------~-------~--~----~
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