i am new in android.i make a simple maths apps. i use the check box for select right option but problem is here the answer option is not only one but also two,three means
It seems you are having more than one checkbox and you are setting global listener for every checkbox. So, in that case you need to identify the event for specific checkbox also.
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked)
{
int id = buttonView.getId();
if(id == R.id.chk)
{
if(chk.isChecked()){
forMetchCheckBox.add(String.valueOf(chk.getText()));
}
else{
forMetchCheckBox.remove(String.valueOf(chk.getText()));
}
}
else if(id == R.id.chk1){
....
}
}
and so on, that will make your listener work perfect.