Look into bitmap mutations?

http://developer.android.com/resources/articles/drawable-mutations.html

On Dec 31 2010, 11:22 pm, John Gaby <jg...@gabysoft.com> wrote:
> I have custom skinned buttons.  I set the bitmaps for the button
> backgrounds using the addState method of the StateListDrawable class
> and pass in a BitmapDrawable which is loaded from a file on the SD
> card.  Now I am having out of memory issues, so I thought that I would
> try and cache the BitmapDrawable and reuse them for all the buttons on
> a page, rather than creating a new one for each button.  However, when
> I do this, the buttons don't display correctly.  For example if I have
> two buttons of different sizes, the background is drawn at the same
> size for both, rather than have each scale.  Also, if one button on
> the page is hidden, then the backgrounds for some of the other (still
> visible) buttons disappear.  This does not happen if I create separate
> BitmapDrawable objects for each of the buttons.
>
> My question is, am I supposed to be able to reuse these objects in
> this manner?  If not, how can I keep from duplicating the memory
> required to skin each button on a page?
>
> Thanks.

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