I have an xml file e.g. "list.xml" :
<?xml version="1.0" encoding="utf-8"?>
<resources>
<array name="country_name">
<item>Switzerland</item>
<item>Iceland</item>
</array>
<array name="flag_url">
<item>url1</item>
<item>url2</item>
</array>
</resources>
Then in my MainActivity.java I do various things with them, but that is not the point here, is there a way I can do something like name.add("CountryName")?
The MainActivity.java:
Resources resources = getResources();
TypedArray name = resources.obtainTypedArray(R.array.country_name);
TypedArray flag = resources.obtainTypedArray(R.array.flag_url);
//-----name.add(CountryName);----
So my list.xml would look like this:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<array name="country_name">
<item>Switzerland</item>
<item>Iceland</item>
<item>CountryName</item>
</array>
<array name="flag_url">
<item>url1</item>
<item>url2</item>
</array>
</resources>