Taking an example from the Dev Guide - you can do it like this:
http://d.android.com/guide/samples/ApiDemos/res/values/arrays.html
In res/values/arrays.xml:
<resources>
<!-- Used in View/Spinner1.java -->
<string-array name="colors">
<item>red</item>
<item>orange</item>
<item>yellow</item>
<item>green</item>
<item>blue</item>
<item>violet</item>
</string-array>
</resources>
//java code
Resources res = this.getResources();
String[] arr = res.getStringArray(R.array.colors);
for(int i=0; i<arr.length-1; i++) {
Log.i("TEST", arr[i]);
}
So R.array.colors is your reference. You can create an ArrayList and
add this array to it if necessary.
mafro
Videoguy wrote:
> Is is possible to specify data in xml resource file and initialize
> ArrayList from it?
> I am looking for a way to use the ArrayList with a SimpleAdapter to
> bind to a ListView.
> I am wondering if there is a way to specify my data in xml resource
> file and init ArrayList from it.
>
> Videoguy
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---