No, there's no need to write XML parsing code in this case.  Resources
support string arrays out of the box.

Mats, you can get the String array by doing something like this:

String[] groups = this.getResources().getStringArray(R.array.groups);

I'm assuming you are accessing it from within a Context (such as an
Activity).  Otherwise, you would have to replace "this" with a Context
object.

-- PJ



On Nov 2, 6:08 pm, Sandeep Chayapathi <[email protected]> wrote:
> you can use the SAX parser in android.util.Xml package. Take a look 
> athttp://www.ibm.com/developerworks/opensource/library/x-android/index....
> a good tutorial on parsing XML in android.
>
> -- Sandeep
>
>
>
> On Sun, Nov 1, 2009 at 6:46 AM, Mats <[email protected]> wrote:
> > Hello, I'm still a beginner with android (and also with Java a Little
> > bit) and i have a problem
>
> > i have and XML document in values with an array in it:
>
> > <?xml version="1.0" encoding="utf-8"?>
> > <resources>
> >    <string-array name="groups">
> >                <item>-</item>
> >                <item>AP_KEU1-1</item>
> >                <item>AP_KEU1-2</item>
> >                <item>AP_KEU1-3</item>
> >                <item>AP_KEU1-4</item>
> >                <item>AP_KEU1-5</item>
> >                <item>AP_KEU1-6</item>
> >                <item>ATE-ORG1</item>
> >                <item>ATr1a</item>
> >                ......
> >    </string-array>
> > </resources>
>
> > how do i get this in an array that i can use like this in the program:
>
> > group[0] = "-"
> > group[1] = "AP_KEU1-1"
> > group[2] = "AP_KEU1-2"
> > group[3] = "AP_KEU1-3"
> > group[4] = "AP_KEU1-4"
> > group[5] = "AP_KEU1-5"
> > group[6] = "AP_KEU1-6"
> > .....
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Beginners" group.
> > To post to this group, send email to [email protected]
> > To unsubscribe from this group, send email to
> > [email protected]<android-beginners%2Bunsubscr 
> > [email protected]>
> > For more options, visit this group at
> >http://groups.google.com/group/android-beginners?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" 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-beginners?hl=en

Reply via email to