NotNotAndroid
NotNotAndroid

Reputation: 125

how to split a string of data into different list views?

Would I be able to split a string of data starting with <NewData> with several different objects inside such as <Schedule> ending in </Schedule> and then ending over all with a </NewData>. Split that into several list views each schedule in a different list view? quite difficult to explain so any thing I've missed just say...

Upvotes: 0

Views: 486

Answers (1)

Reno
Reno

Reputation: 33792

Umm I'll only give you a hint,

 String stuff = "<Schedule> save kittens </Schedule> " +
                             "<Schedule> and puppies </Schedule>" ;

 String [] result = stuff.split("<Schedule>");
 for(int i = 0; i < result.length; i++)
 {
          if(result[i].length() > 0)
            Log.d("TODO", " - " + result[i].substring(0, result[i].indexOf("<")));
 }

Upvotes: 2

Related Questions