android - Iteration Through R class -
Is there any possible way to iterate RROR or Ardoable or any R-class? I have to dynamically get every ID on that folder.
ArrayList resArray = new ArrayList (); Forchha (Int id: RO.A.) {resArray.add (ID); } Or is there any other way?
You can do this via Java reflection:
class Raw = R.raw.class; Field [] fields = raw .getFields (); (Field field: field) {try.log (ii ("reflection", string.format ("% s is% d", field.getName (), field.getInt (null));} hold (IllegalAccessException e) {Log.e ("Reflection", String.format ("% s threw IllegalAccessException.", Field.getName ()));}}
Comments
Post a Comment