android - How to get a item with identificator from a R.array.element? -
I have an array with the next material from the resource content in Array.xml.
& lt; Resources & gt; & Lt; String-array name = "songs" & gt; & Lt; Item name = "id" & gt; 1 & lt; / Item & gt; & Lt; Item name = "title" & gt; Song1 & lt; / Item & gt; & Lt; Item name = "id" & gt; 2 & lt; / Item & gt; & Lt; Item name = "title" & gt; Song2 & lt; / Item & gt; & Lt; Item name = "id" & gt; 3 & lt; / Item & gt; & Lt; Item name = "title" & gt; Song 3 & lt; / Item & gt; & Lt; Item name = "id" & gt; 4 & lt; / Item & gt; & Lt; Item name = "title" & gt; Lyrics & lt; / Item & gt; & Lt; / String array & gt; & Lt; / Resources & gt; I am getting the values of the array next to:
songs_array = arrays.asList (GetResources (.) GetStringArray (R. song)); But it shows me:
1 song1 2 song2 3 song3 4 song4 I want to know Is it just a way to get the title to show:
song1 song2 song3 song4 Thanks.
Your array really looks like this:
& lt ; String-array name = "songs" & gt; & Lt; Item name = "id" & gt; 1 & lt; / Item & gt; & Lt; Item name = "title" & gt; Song 1 & lt; / Item & gt; & Lt; Item name = "id" & gt; 2 & lt; / Item & gt; & Lt; Item name = "title" & gt; Song 2 & lt; / Item & gt; & Lt; Item name = "id" & gt; 3 & lt; / Item & gt; & Lt; Item name = "title" & gt; Song 3 & lt; / Item & gt; & Lt; Item name = "id" & gt; 4 & lt; / Item & gt; & Lt; Item name = "title" & gt; Lyrics & lt; / Item & gt; & Lt; / String array & gt; That's why you get results in that way. As Raghunathan has mentioned, get rid of ID;)
Comments
Post a Comment