안드로이드 개발 질문/답변
(글 수 45,052)
Checkbox Listener를 등록할려고 했더니,
The method setOnCheckedChangeListener(CompoundButton.OnCheckedChangeListener) in the type CompoundButton is not applicable for the arguments (Hold)
라고 하면서 등록을 안시켜주세요 ㅠ,.ㅠ
코드는 아래와 같습니다.
오류나는 행은 24번 라인 setOnCheckedChangeListener 부분입니다.
import android.os.Bundle;
import android.text.*;
import android.widget.*;
public class Hold extends Activity {
CheckBox holdable;
EditText password;
EditText confirm_password;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.hold);
holdable = (CheckBox)findViewById(R.id.holdable);
password = (EditText)findViewById(R.id.password);
confirm_password = (EditText)findViewById(R.id.confirm_password);
if (holdable.isChecked()) {
password.setEnabled(false);
confirm_password.setEnabled(false);
}
holdable.setOnCheckedChangeListener(this);
password.setFilters(new InputFilter[] { new InputFilter.LengthFilter(4) });
confirm_password.setFilters(new InputFilter[] { new InputFilter.LengthFilter(4) });
}
public void onCheckedChanged (CompoundButton buttonView, boolean isChecked) {
if (buttonView.getId() == R.id.holdable) {
if (isChecked) {
password.setEnabled(false);
confirm_password.setEnabled(false);
}
else {
password.setEnabled(true);
confirm_password.setEnabled(true);
}
}
}
}
this대신에 직접 이벤트 핸들러 넣어봤는데, 그래도 안되네요;




classHoldextendsActivity implements OnCheckedChangeListener