1
ArrayList<ArrayList<String>> mainlist = new ArrayList<ArrayList<String>>();
ArrayList<String> childlist = new ArrayList<String>();

for (int i = 0; i < 3 i++){
   String chlidtext = chlidlist + String.valueof(i);
   String maintext = mainlist +String.Valueof(i);
   childlist.add(chlidtext);
   mainlist.add(maintext);
}
 return mainlist;

我不知道如何在每个 chlidlist 中获取第三个元素?

4

1 回答 1

1

您可以通过以下方式访问 childList 的第三个元素:

mainList.get(index).get(2); // Here 1st get() will get the 1st element of mainList which conatins 1st child element and 2nd get() will get the 3rd element of childlist.
于 2012-08-17T06:34:39.020 回答