0

Suppose this sample definition in res/values/a_file.xml:

<array name="theme0">
    <item name="widgetBackground">@color/widget_background0</item>
    <item name="widgetGlowColor">@color/widget_glowColor0</item>
    <!-- etc -->
</array>

And this code in java:

int[] arr = context.getResources().getIntArray(R.array.theme0);

Now you can easily access to its members: arr[0], arr[1], ...


But I want to access its members by their names. Something like:

arr.getMemeber("widgetBackground")
arr.getMemeber("widgetGlowColor")
...

Or everything by name, not by number. Is it possible?

Mir-Ismaili
  • 13,974
  • 8
  • 82
  • 100
  • better you use custom attributes for this purpose. https://developer.android.com/training/custom-views/create-view.html#applyattr – ugur Feb 04 '17 at 20:08
  • or http://stackoverflow.com/a/5052401/5923606 – ugur Feb 04 '17 at 20:08

0 Answers0