I am doing functionality of checkbox and it is working fine for checked but when i uncheck the checkbox it gives error.. and one thing when i checked the checkbox i am storing id of that item into arraylist and i want to remove that id when uncheck the checkbox
final CheckBox checkBox = listViewItem.findViewById(R.id.edit);
checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (buttonView.isChecked() ) {
proUseritems.add(String.valueOf(heroList.get(position).getProfile_id(position)));
Toast.makeText(mCtx, "" + proUseritems.toString(), Toast.LENGTH_SHORT).show();
}
else {
proUseritems.remove(position);
Toast.makeText(mCtx, "" + proUseritems, Toast.LENGTH_SHORT).show();
}
}
});
Aucun commentaire:
Enregistrer un commentaire