這是我用來從數據庫動態加載數據的代碼,但我沒有得到如何動態檢查或取消選中複選框?這是我正在使用的代碼。如何在android中動態檢查/取消選中listview中的複選框?
String[] from = new String[]{"ToDisplay","MblNo", "_id"};
// and an array of the fields we want to bind those fields to (in this case just tvViewRow)
int[] to = new int[]{R.id.tvViewRow};
// Now create a simple cursor adapter and set it to display
SimpleCursorAdapter cursor = new SimpleCursorAdapter(this, R.layout.white_row, coloursCursor, from, to);
setListAdapter(cursor);
Cursor curs = DisplayWhiteAddress();
curs.moveToFirst();
int i=0;
while(!curs.isAfterLast()){
String s=""+curs.getString(2);
myArrayList.add(i, s);
s=""+curs.getString(0);
myNumberList.add(i, s);
ListIndices.add(i,Integer.parseInt(""+curs.getString(0)));
curs.moveToNext();
i++;
}