如何选择不带按钮的复选框,以及如果用户未选中某项,则返回null。
我如何从复选框调用数据
这是我使用按钮的任务。我是从适配器调用的。
我在适配器中声明了复选框:
holder.setItemCheckBox(new CheckboxListener() {
@Override
public void respond(View v, int position) {
CheckBox chk = (CheckBox) v;
double checkedSum = 0;
//Check if checked or not
if(chk.isChecked()){
checkdata.add(catalogDatabases.get(position));
}else if(!chk.isChecked()){
checkdata.remove(catalogDatabases.get(position));
}
}
});
这是我的界面:
public interface CheckboxListener {
void respond (View v, int position);
}