I have three arrays:
[code=java]final string[] names = Mthemeresources.getstringarray (names);
Final string[] Infos = Mthemeresources.getstringarray (info);
Final string[] tos = Mthemeresources.getstringarray (to); [/code]
How to save these three arrays into an array such as
{
Names[0] infos[0] tos[0],
NAMES[1] infos[1] tos[1],
NAMES[2] infos[2] tos[2],
...........
}
and displayed on the ListView, each item on the ListView has three TextView, respectively: Names,infos,tos
1.
You can put three list<map<string,string>>,map with a
| 123456 |
for(i=0;i<names.length;i++){map.put("name",names[i]);map.put("info",infos[i]);map.put("to",tos[i]);list.add(map);} |
It's almost like that, not in eclipse, there are a few mistakes you can debug yourself.
2. The first one can help you implement the code as follows:
private static void Test () {
String[] name = {"1", "2", "3"};
String info[] = {"A", "B", "C"};
String to[] = {"?", "?", "?"};
linkedlist<string> temp = new linkedlist<string> ();//linkedlist linked list structure insert fast
for (int i = 0; i < name.length; i++) {
Temp.add (Name[i]);
}
for (int j = 0; J < Info.length; J + +) {
if (j = = 0) {
Temp.add (j + 1, info[j]);
} else {
Temp.add (J * 2 + 1, info[j]);
}
}
for (int k = 0; k < to.length; k++) {
if (k = = 0) {
Temp.add (k + 2, to[k]);
} else {
Temp.add (3 * k + 2, to[k]);
}
}
System.out.println (Temp.tostring ());
}
The second one is not difficult, but I haven't tried it. The ListView item added TextView feeling is not feasible, should be with item side-by-side TextView, like the mobile phone QQ dialog item left slide will appear a delete button.
Android Merge Array