We are trying to dynamically add an array in a java file to a xml file.
We have an ArrayList catList which is filled by reading a xml file from a website. The ArrayList is filled like this: [item1, item2, item3, item4, item5].
preferences.xml
<?xml version="1.0" encoding="utf-8"?>
<ListPreference
android:title="Ondernemer selecteren"
android:summary="Bij deze optie kunt U kiezen van welke ondernemer U de agenda wilt zien."
android:key="listPref"
android:defaultValue="Standaard"
android:entries="@array/ondernemerArray"
android:entryValues="@array/ondernemerValues"
/>
</PreferenceScreen>
arrays.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="ondernemerArray">
<item></item>
</string-array>
<string-array name="ondernemerValues">
<item></item>
</string-array>
Does anyone know how we can put the catList array dynamically into the xml file, between the elements and dynamically increase the amount of elements?
resourcesat runtime. Once they are compiled, that's it. You will need to store them in some form of persistent storage