I am working on an example of building a list and I want to change it to pull an array from an array file (code and data are separated)
So, instead of declaring an array inside a class, for example
private static final String[] items={"A", "B", "C","D", "E", "F"};
I have a string array in r.arrays.xml called exercises
<resources>
<array name="exercises">
<item>Kettlebells - Swing, Two handed</item>
<item>Kettlebells - Swing, One handed</item>
<item>Kettlebells - Squat"</item>
<item>Kettlebells - Deadlift"</item>
<item>"Kettlebells - Lunge"</item>
<item>"Kettlebells - Press</item>
</array>
Replaced existing
setListAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, items));
with
setListAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, R.array.exercises));
However, the list does not seem to be populated with an array
All help is appreciated (from a slightly confusing novice programmer)
source
share