I\'m trying to do a listview with a checkbox but i can\'t do it. I don\'t know how i can implement the listener that tell me if the ckeckbox is selected or isn\'t selected.
Check this tutorial it explains holder pattern in listView Tutorial
Also remember that you need to assign any onClickListener or onCheckListener in getView() method of your adapter
In getView(...)
you have to use CompoundButton.OnCheckedChangeListener try to use ViewHolder pattern
code snippet
viewHolder.checkbox = (CheckBox) view.findViewById(R.id.checkBox1);
viewHolder.checkbox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView,
boolean isChecked) {
TemaRescatado element = (TemaRescatado) viewHolder.checkbox
.getTag();
element.setSelected(buttonView.isChecked());
}
});