i am developing an android application and have a togglebutton (id=”tt”) in one of my layouts. what i am trying to do is set an OnClickListener to that togglebutton. But i am getting the following errors in eclipse:
toggleButton cannot be resolved to a variable
onClickListener cannot be resolved to a type
Here’s the code:
public void ToggleMagic(){
toggleButton = (ToggleButton)findViewById(R.id.tt);
toggleButton.setOnClickListener(new OnClickListener(){
//
});
}
You missed
ToggleButtonbefore toggleButton on second line.