I try to do radio-buttons in expandable list view. Some children are with checkboxes, but some with radio-button. And i need them to act like radio group. What's wrong with my code? ( added it in ChildView)
if(rad_group.equals("rg1")) { //children, that should have radio-button
rbut.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (rbut.isChecked()) {
mSelectedChildPosition = childPosition;
mSelectedGroupPosition = groupPosition;
notifyDataSetChanged();
}
}
});
if (mSelectedChildPosition != childPosition && mSelectedGroupPosition != groupPosition) {
rbut.setChecked(false);
} else {
rbut.setChecked(true);
if (mSelectedRB != null && rbut != mSelectedRB) {
mSelectedRB = rbut;
}
}
}
Aucun commentaire:
Enregistrer un commentaire