I want functionality in my project where on a click of select all checkbox all the checkbox in the list must get selected and on deselect of checkbox all the other checkbox must get deselected. I have achieved this functionality by doing this:
/*in my main activity i have done this*/
cbSelectAll.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
for (int i = 0; i < resumeSearchList.size(); i++) {
resumeSearchList.get(i).setSelected(cbSelectAll.isChecked());
}
cvSearchResultListAdapter.notifyDataSetChanged();
}
});
}
and in adapter class I have done this..
holder.cbSelect.setChecked(dataList.get(position).isSelected());
Now my problem is whenever I will unchecked any checkbox in the list the select all button must get unchecked. Please help
thanks in advance
Aucun commentaire:
Enregistrer un commentaire