我使用以下代码创建了一个列表/表格排序。
ListView list = (ListView) findViewById(R.id.list1);
btn = (Button) findViewById(R.id.btTaken);
ArrayList<HashMap<String, String>> mylist = new ArrayList<HashMap<String, String>>();
HashMap<String, String> map = new HashMap<String, String>();
String Date;
//list.setOnItemSelectedListener((OnItemSelectedListener) this);
// list.setOnItemClickListener(ListItemClick);
// cb.setVisibility();
Date=AttendanceDao.Dates()[0];
for(i=0;i<AttendanceDao.Dates().length;i++)
{
map = new HashMap<String, String>();
map.put("Date", AttendanceDao.Dates()[i]);
//map.put("StudentName",Data.Sname()[i]);
mylist.add(map);
}
// ...
SimpleAdapter mSchedule = new SimpleAdapter(this, mylist, R.layout.att_date_list,
AttendanceDao.Datemap(), new int[] {R.id.Sid});
list.setAdapter(mSchedule);
这部分代码
protected void onListItemClick(ListView l, View v, int position, long id) {//this guy is not working!
// TODO Auto-generated method stub
Intent openActivity = new Intent("net.vrixx.activities.ATTENDANCELISTACTIVITY");
startActivity(openActivity);
}
应该听在我的列表中单击的项目。但它不起作用 任何人都可以找出原因吗?谢谢!