i have to develop one app.here i have to use checkbox.here i have to select checkbox means the default background color is yellow.but i wish to change the background
if you are intersted to change the background color of the checkbox (button) use
mcheckbox.setButtonDrawable(R.drawable.someotherbackground);
where someotherbackground is an image in the drawable folder to which background you want your checkbox to be changed
try as below
mcheckbox.setOnCheckedChangeListener(new OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView,
boolean isChecked) {
if (isChecked) {
System.out.println("checked" + isChecked);
mcheckbox.setButtonDrawable(R.drawable.imageWhenActive);
System.out.println("app constant is set as "+isChecked);
}
else
{
mcheckbox.setButtonDrawable(R.drawable.imageWheninactive);
System.out.println("app constant is set as "+isChecked);
}
}
});