嘿我想在hashmap
中存储一些值以放入自定义视图。
问题是在我hashmap
的put方法中分配键时,当我尝试从键获取错误时一个与我的另一个对象相关的对象中的变量
这是我的代码:
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);
logcat的:
答案 0 :(得分:0)
似乎
a.kunde
为空