I´m creating a game for my college project and I was wondering if I can get the names(just the names) of the images I put inside the /drawable folder in android. It can also be the files I put inside the /raw folder, the option that works better.
Asked
Active
Viewed 935 times
0
-
check this http://stackoverflow.com/questions/3221603/android-retrieving-all-drawable-resources-from-resources-object – Libin May 12 '14 at 23:35
-
thanks, but do you have an exeample about how to use this AssetManager? how can I obtain an instance of it? – Fabio Phillip Rocha Marques May 13 '14 at 01:18
-
@FabioPhillipRochaMarques http://developer.android.com/reference/android/content/Context.html#getAssets() – matiash May 13 '14 at 01:45
1 Answers
1
Use the following snippet
Field[] ID_Fields = R.drawable.class.getFields();
for (Field f : ID_Fields) {
try {
System.out.println(f.getName() + "sample");
} catch (IllegalArgumentException e) {
e.printStackTrace();
}
}

Shrinithi
- 326
- 4
- 9