Android Merge Array

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.