i have a check box in list view to select items and i have one button outside the list view initially the check box should be hide, when i click that button check box should display in list view and vice versa .i have one issue in that,when i press the button initially it display one checkbox and again i press the button it show few check box but what i want was initially it should be invisible when i press the button it should be visible in list view Note:i have a button in class and checkbox in adapter
sdel.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
((datalist) mlistView.getAdapter()). toggleChecks();
((datalist)mlistView.getAdapter()).notifyDataSetChanged();
}
});
public void toggleChecks() {
for (int i = 0;i<sms.size();i++) {
holder.cb.setVisibility(CheckBox.VISIBLE);
} isCheckBoxVisible=!isCheckBoxVisible;
notifyDataSetChanged();
}
Aucun commentaire:
Enregistrer un commentaire