当我单击ListView
. 例如; 当code=1我想得到不同的值,当code=2我想得到不同的值。我怎样才能做到这一点?
这是我的代码。
Element e = (Element) nl.item(i);
map.put(KEY_CODE, conParser.getValue(e, KEY_CODE));
map.put(KEY_NAME, conParser.getValue(e, KEY_NAME));
map.put(KEY_COVERS, conParser.getValue(e, KEY_COVERS));
map.put(KEY_TABLE, conParser.getValue(e, KEY_TABLE));
map.put(KEY_SALES, conParser.getValue(e, KEY_SALES));
items.add(map);
}
final ListAdapter adapter = new SimpleAdapter(this, items,
R.layout.list_item,
new String[] {KEY_CODE,KEY_NAME,KEY_COVERS,KEY_TABLE,KEY_SALES},
new int[] {R.id.kod, R.id.name,R.id.person,R.id.table,R.id.sale});
setListAdapter(adapter);
ListView list= getListView();
reportList.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
// TODO Auto-generated method stub
startActivity(new Intent(NewActivity.this,SingleNewActivity.class));
}
});