0

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.

1 Answers1

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