버튼을 누를 때마다 텍스트가 변경되고 불리언 값이 변경되지만 작동하지 않습니다. 어떤 도움이 필요합니까? Thnks는버튼을 눌렀을 때 상태가 변하지 않습니다.
에서 onCreate 전에:
public boolean status = false;
버튼 클릭
case R.id.saveButton:
if (status != true) {
currentStatus.setText("Current status: In need of help!");
status = true;
}
if (status != false) {
currentStatus.setText("Current status: Fine.");
status = false;
}
break;
에서 왜! = 거짓 View.OnClickListener 구현? 'if'에 상태를 직접 넣으십시오 – Darpan
더 많은 코드를 게시하십시오 ... –
우리는 더 많은 정보가 필요합니다. 이 코드는 어떻게 호출됩니까? 귀하의 텍스트가 바뀌 었습니까? 디버거를 사용해 보셨습니까? – jhamon