执行到setAdapter()时提示数组越界
老师呀,之前的步骤都没有问题,就到执行lv.setAdapter(sim_adapter)时就报错退出了,提示是java.lang.ArrayIndexOutOfBoundsException: length=1; index=1
sim_adapter = new SimpleAdapter(this,getData(),R.layout.sim_adapter1,new String[]{"pic,text"},new int[]{R.id.sim_pic,R.id.sim_text});
System.out.println("sim_adapter is ok");
//2.视图加载适配器
lv.setAdapter(sim_adapter);
--------
private List<Map<String,Object>> getData(){//写一个getData方法,返回值是特定范型List<Map<String,Object>>
List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
for(int i=0;i<5;i++)
{
System.out.println(i);
Map<String,Object> map = new HashMap<String,Object>();
map.put("pic",R.drawable.ic_launcher);
map.put("text", "Ergou" + i);
list.add(map);
}
System.out.println(list);
return list;
}