Drawable.createFromStream() and OutOfMemoryError exception

by Atif Gulzar » Tue, 10 Nov 2009 22:11:45 GMT


Sponsored Links
 seems this is a reported bug?
 http://code.google.com/p/android/issues/detail?id=294 


--
Best Regards,
Atif Gulzar

I  Unicode, zln 







--



Drawable.createFromStream() and OutOfMemoryError exception

by Atif Gulzar » Wed, 11 Nov 2009 12:05:59 GMT


 ump

Hi,

Would you please help me how to handle the memory leak on
Drawable.createFromStream()?

I am receiving a base64 image from a webservice. And I decode it using
Apache lib. After that I convert it to drawable through
Drawable.createFromStream(). But when the image size is bit larger (~>350kb)
it starts throwing OutOfMemoryError exception. Ok, I can handle this by
catching this exception. But eventually after catching 2 or 3 such
exceptions the heap is full and it start throwing exceptions for other
methods and for small images as well.

The relevant code snip is given below.


byte[] arr = null;
InputStream imageStream = null;
try
{
arr = Base64.decodeBase64(result.





On Tue, Nov 10, 2009 at 7:11 PM, Atif Gulzar <atif.gul...@gmail.com> wrote:


--


Sponsored Links


Other Threads

1. No measured width and height for inflated layout

override onSize(), computescroll() method, then call SetVisiblity().
Would you want to design self scrollView dialog?
Please give some code here,  it is possible to say something right.




> 

2. writing a notification widget for Yahoo mail

Hi,

I'm a new-ish Android dev. trying to write one of the following:

* a custom notification app that will create a custom icon in the
notification bar when yahoo mail is received in a certain yahoo email
account similar to the "google notifier" app

OR

* a "yahoo mail unread count" widget similar to the "google unread
count" app which will display the number of unread yahoo emails in a
desktop widget/icon badge

I know the new Yahoo mail app is out, but I'm not sure if it's
possible to get "new mail intents" from it, or if it broadcasts any
intents or other info at all.

Does anybody have any tips on how to proceed on this?

I was thinking of perhaps trying to use the javamail open source api
to read the user's yahoo mail via javamail, and then write a
notification app or widget app.  Does that sound reasonable?

Thanks for any ideas.  :)

-- 

3. Issue with getByteArrayRegion returning LARGE byte arrays. (JNI Code)

4. How to remove data in the list view

5. Trouble with Live Wallpaper

6. Pattern 4: Action Bar

7. DVFS on the Nexus One