Well, it's not what you asked for (since drawables come from different
directories) but it may be closer to what you are looking for.

You can use Java reflection to find all the public fields in
R.drawable.

The drawable directory doesn't exist at runtime; the contents are
packaged up into the .apk file.

If that's not what you need to know, here are a couple of other
possibilities:

The assets directory DOES exist at runtime, at least conceptually; you
can access that via the AssetManager, which provides a method to list
the contents in a particular directory within the assets folder.

Finally, you can use Environment.getExternalStorageDirectory() to get
a Java File object referring to the SD card, or
Environment.getDataDirectory() to get an on-board location available
to your program (but smaller, of course).

On Dec 12, 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
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to