这是我的代码:
private void genData(){
List<String> title = Arrays.asList("Android Programing","IOS Programing");
List<String> childitem = Arrays.asList("hello","hi","what is up");
lstChild = new TreeMap<>();
lstChild.put(title.get(0),childitem);
lstChild.put(title.get(1),childitem);
lstTitle = new ArrayList<>(lstChild.keySet());
List<String> titleq = Arrays.asList("Xamarin ");
List<String> childitemq = Arrays.asList("hello","hi","what is up");
lstChild = new TreeMap<>();
lstChild.put(titleq.get(0),childitemq);
lstChild.put(titleq.get(1),childitemq);
lstChild.put(titleq.get(2),childitemq);
lstTitle = new ArrayList<>(lstChild.keySet());
}
private void initItems(){
items = new String[]{"Home","Who we Are","services","online Marketing","Get free Quote","Contact"};
}
我面临的错误: at java.util.Arrays $ ArrayList.get(Arrays.java:3769)
我想在Xamarin plz帮助中添加6个孩子
答案 0 :(得分:0)
此列表
List<String> titleq = Arrays.asList("Xamarin ");
只有一个项目。在这里
lstChild.put(titleq.get(0),childitemq);
lstChild.put(titleq.get(1),childitemq);
lstChild.put(titleq.get(2),childitemq);
你得到的不止一件物品。我相信有错误。
更确切地说是lstChild.put(titleq.get(1),childitemq);