嘿,我正在尝试将一些值存储在 ahashmap
中以放入自定义视图中。问题是在我的 put 方法中分配键时,当我尝试从与我的另一个对象一起的对象中的变量中获取键hashmap
时出现错误
这是我的代码:
ListView lv= (ListView)findViewById(R.id.listView1);
String[] from = new String[] {"fornavn", "starttid", "sluttid"};
int[] to = new int[] { R.id.Kunde, R.id.StartTime, R.id.EndTime };
List<HashMap<String, String>> fillMaps = new ArrayList<HashMap<String, String>>();
for(Appointment a : todayList) {
HashMap<String, String> map = new HashMap<String, String>();
//here is my error I don't know what to put as key??
map.put("kunde.fornavn", "col_1_item_" + a.kunde.fornavn);
map.put("starttid", "col_2_item_" + String.valueOf(a.startTime));
map.put("sluttid", "col_3_item_" + String.valueOf(a.endTime));
fillMaps.add(map);
}
SimpleAdapter adapter = new SimpleAdapter(this, fillMaps, R.layout.row, from, to);
lv.setAdapter(adapter);
日志猫: