Hi,

The problem is you're creating a new bitmap every time onDraw is called. As 
your app can only typically allocate about 16Mb or 24Mb in total in Java, 
you're going to run out of memory quickly if the onDraw method gets called 
often. I'm not sure why the set of bitmaps aren't being garbage collected 
here but, even if they were, your app will suffer from stuttering being 
caused by the GC with this approach.

What you should do is create the bitmap once somewhere else and then reuse 
this single bitmap object in your onDraw method. Related to this, make sure 
to call .recycle() on any bitmap object you're finished with to indicate 
that the memory it is using is not needed any more.

Regards,

Sean

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

Reply via email to