本人写了一个如下代码:
SimpleCursorAdapter adapter = new SimpleCursorAdapter(this,
android.R.layout.simple_list_item_multiple_choice, cursor,
arrayOfString, new int[] { android.R.id.text1,
android.R.id.text2 });
setListAdapter(adapter);
mListView = getListView();
mListView.setItemsCanFocus(false);
mListView.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
View v = view;
CheckBox checkBox = (CheckBox) view
.findViewById(android.R.id.text2);
Log.d("^^^^^^^^^^^^^^^^^^^^^^^^^^^^", checkBox + " ");
if (checkBox.isChecked()) {
mView.add(v);
}
}
});
但是每次获取的CheckBox是空的,无论是android.R.id.checkbox 还是 android.R.id.text1,都获取不了checkBox,怎么获取呢?(主要是为了删除checkBox所在Item)?
------解决方案--------------------
解决了就好