我使用以下代码创建了一个列表/表格排序。
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);
}
应该听我点击列表中的项目。但它不起作用任何人都可以找出原因吗?谢谢!
答案 0 :(得分:0)
list.setOnItemSelectedListener(new OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> arg0, View arg1,
int arg2, long arg3) {
// TODO Auto-generated method stub
}
@Override
public void onNothingSelected(AdapterView<?> arg0) {
// TODO Auto-generated method stub
}
});