check box not working
<p>I need your assistance in my following scenario.</p>

<p>I have three checkboxes A, B and C and variables a. If I click on Checkbox B, the value of a should be kept 2 and if I check A then this should be changed to 3 and if I deselect it should go back to 2.</p>

<p>How to obtain this dynamically?</p>

<p>I am using onCheckedChangeListener which changes the variable only when I change the checked state of the checkboxes.</p>

<p>Any help is much appreciated.</p>

<p>few codes:</p>

<p>Code for ChkBxA :</p>

<pre><code>    ChkBxA.setOnCheckedChangeListener(new OnCheckedChangeListener() {

    public void onCheckedChanged(CompoundButton buttonView,boolean isChecked) 
    {
        if (buttonView.isChecked()) 
        {
            variable_a = 1;
        }
        else 
        {
            variable_a = 0;
        }
    }
});
</code></pre>

<p>ChkBxB Code:</p>

<pre><code>ChkBxB.setOnCheckedChangeListener(new OnCheckedChangeListener() {

    public void onCheckedChanged(CompoundButton buttonView,boolean isChecked) 
    {
        if (buttonView.isChecked()) 
        {
            if(variable_a == 1)
            {
                variable_b = 3;
            }
            else 
            {
                variable_b = 2;

            }
        }
        else 
        {
            variable_b = 0;
        }
    }
});
</code></pre>

<p>The issue is as the value of variable_a changes when the state of the checkbox A, the value of variable_b doesn't change as this is within the checkedChangeListener. So any advice to overcome this is much appreciated.</p>
