I would recommend just having another resource holding an array of the
drawables to include.  See for example this declaring one:

http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob;f=core/res/res/values/arrays.xml;h=a0bc5b36923f5d88d4bbc98645d29340d187d434;hb=HEAD#l24

<http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob;f=core/res/res/values/arrays.xml;h=a0bc5b36923f5d88d4bbc98645d29340d187d434;hb=HEAD#l24>And
this reading it:

http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob;f=core/java/com/android/internal/os/ZygoteInit.java;h=b677b1e6048988a02ddb65ee2dff54acd82061ba;hb=HEAD#l415

Sure, it is one more step required when adding a resource, but at runtime it
is going to be far more efficient than other solutions that require scanning
through resources or R symbols or such.

On Sun, Dec 12, 2010 at 8:17 PM, darrinps <darri...@gmail.com> wrote:

> Is there any way for an Android app to read the file names of all the
> files stored under drawable (or for that matter any other directory)?
>
> I'd like to have it so I can plop in a new file and have the app read
> the name for me for use in a dynamically sized list of radio buttons
> (one button per file) that lists the name of the file by the radio
> button.
>
> I've done something like this with contacts, but I am not sure how you
> read the file names from something like the drawable directory!
>
> Thanks.
>
> Darrin
>
> --
> 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<android-developers%2bunsubscr...@googlegroups.com>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>



-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

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