Android アプリケーションを開発しており、レイアウトの 1 つにトグルボタン (id="tt") があります。私がやろうとしているのは、OnClickListener をそのトグルボタンに設定することです。しかし、Eclipseで次のエラーが発生しています:
toggleButton cannot be resolved to a variable
onClickListener cannot be resolved to a type
コードは次のとおりです。
public void ToggleMagic(){
toggleButton = (ToggleButton)findViewById(R.id.tt);
toggleButton.setOnClickListener(new OnClickListener(){
//
});
}