我已经编写了代码以从数据库中获取值并将该值绑定到列表视图。为此,我现在根据要求使用了自定义列表视图,我想要列表中每个项目的复选框。如何做到这一点
image=(ImageView)findViewById(R.id.image);
note=(ImageButton)findViewById(R.id.note);
tick=(ImageButton)findViewById(R.id.tick);
cross=(ImageButton)findViewById(R.id.cross);
Intent intent = getIntent();
Bitmap photo = (Bitmap) intent.getParcelableExtra("photooo");
image.setImageBitmap(photo);
if(photo!=null)
{
dbHelper = new RecordsDbAdapter(this);
dbHelper.open();
displayListView();
}
}
private void displayListView() {
Cursor cursor = dbHelper.fetchAllRecords();
String[] columns = new String[] {
RecordsDbAdapter.KEY_NAME,
RecordsDbAdapter.KEY_BIRTHDAY,
};
int[] to = new int[] {
R.id.name,
R.id.birthdate,
};
dataAdapter = new SimpleCursorAdapter(
this, R.layout.row,
cursor,
columns,
to);
ListView listView = (ListView) findViewById(R.id.list);
listView.setAdapter(dataAdapter);
}
}