Issue
The thing I’m trying is to check all those checkboxes, when “cbkomplet” is checked.
But it doesn’t work.
Here’s the code I have so far.
CheckBox repeatChkBx ( CheckBox ) findViewById( R.id.cbkomplet );
repeatChkBx.setOnCheckedChangeListener(new OnCheckedChangeListener()
{
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked)
{
if ( isChecked )
{
cbreg.isChecked();
cbtank.isChecked();
cbzoop.isChecked();
cbkom.isChecked();
cbmaske.isChecked();
cbbl.isChecked();
}
}
});
Solution
You want to call setChecked()
, not isChecked()
on the dependent check boxes. You are simply testing if each of them is checked, then throwing away the result.
http://developer.android.com/reference/android/widget/CompoundButton.html#setChecked(boolean)
Answered By – Jeffrey Blattman