0
我在android中有一個字符串。如何在android中將數據拆分並設置爲listview?
str = |test1:23|st1:4|st2:3|st3:5|test2:25|st1:5|st2:6|st3:7|test3:26|st1:5|st2:2|st3:8|test4:28|st1:8|st2:3|st3:2|test5:29|st1:1|st2:2|st3:2|......
I need to split that string and set each data to listview in android.
I mean for each listitem I should keep the data as
test1:23
st1:4
st2:3
st3:5
---------------------
test2:25
st1:5
st2:6
st3:7
----------------------
現在我將分割字符串|使用符號:
String splitstring = str.split("\\|");
現在splitstring[0]
包含test1:23
,splitstring[1]
包含sty:4
。但我需要設置第一個4到第一個列表項,下一個四個到下一個列表項等等。 請告訴我如何才能完成那項任務?提前致謝。