I'm coding an application that deals with 2 different CheckBoxes. When one CheckBox gets clicked, the color of the tick should be blue (instead of green), whereas the color of the other CheckBox remains green.
This is my code...
CheckBox green = (CheckBox) findViewById(R.id.greenButton); CheckBox blue = (CheckBox) findViewById(R.id.blueButton); blue.setOnCheckedChangeListener(new OnCheckedChangeListener(){ public void onCheckedChanged(CompoundButton arg0, boolean arg1) { if(arg1){ blue.setHighlightColor(Color.BLUE); Toast.makeText(getBaseContext(), "Question Marked As Partial", 4000).show(); } } }); green.setOnCheckedChangeListener(new OnCheckedChangeListener(){ public void onCheckedChanged(CompoundButton arg0, boolean arg1) { if(arg1){ blue.setHighlightColor(Color.GREEN); Toast.makeText(getBaseContext(), "Question Marked As Fully Understood!", 4000).show(); } } }); However, both the CheckBoxes tick colors remains green, and the Toast message doesn't get displayed, so I am guessing that the OnCheckedChangeListener is never being called.
Could someone offer any advice?
System.out.println()statements, to check that your code is definately being called. My guess is that this whole piece of code isn't even being called (so the listeners aren't getting placed on the checkboxes), rather than it being a problem with the actual listeners.