Android Resources edit

Define integer array

In order to define an integer array write in a resources file

res/values/filename.xml

<integer-array name="integer_array_name">
    <item>integer_value</item>
    <item>@integer/integer_id</item>
</integer-array>

for example

res/values/arrays.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <integer-array name="fibo">
        <item>@integer/zero</item>
        <item>@integer/one</item>
        <item>@integer/one</item>
        <item>@integer/two</item>
        <item>@integer/three</item>
        <item>@integer/five</item>
    </integer-array>
</resources>

and use it from java like

int[] values = getResources().getIntArray(R.array.fibo);
Log.i("TAG",Arrays.toString(values)));

Output

I/TAG: [0, 1, 1, 2, 3, 5]

Table Of Contents
9 Resources
39 ACRA
64 Menu
112 Loader
119 Xposed
132 Colors
135 Fresco
140 AdMob
147 Button
156 Vk SDK
170 XMPP
176 OpenCV
200 FileIO
203 Moshi
217 Paint
231 AIDL
241 JCodec
243 Okio
255 Looper
  ↑ ↓ to navigate     ↵ to select     Esc to close