What is the best way to store/load/handle a lot of Drawables for my
application?

Let me explain....

- Let's say I need to display a lot of small avatar images in my
application
- Let"s say each avatar image has a size of 40x40 and I need to
display 32 different sprites. Not all at the same time, but I might
have to display 10 of them on the screen at the same time. In addition
I need to draw them on a canvas were they walk around or something...

My reflex would be to create one PNG with 4x8=32 tiles (size :
320x160).
For drawing the sprites on my canvas I would allocate a bitmap for
each sprite, load it and then and draw it when I need to (case #1)
However, I also need to display the avatars in other views, e.g. in a
ListView in a different activity (case #2).

For #2, it would be very convenient if I could have them as Drawables.
So should I just have 32 pngs in my res/drawable directory ?

I feel like it would be great to have something like a SpriteDrawable
where I could specify in an xml file which part of a bigger bitmap I
want to use as a drawable on its own.

Or is it totally fine to have A LOT of small PNGs in my res/drawable
folder ? Does the packaging process optimize them anyways?

Would be great to get some input on these thoughts... Any comments
appreciated.







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