-4
사용자가 클리어를 클릭했을 때 디스플레이가 아무 것도 아니기 때문에 빈 문자열을 인쇄합니다. 하지만 웬일인지, 대신에 0이 생깁니다. 그 이유는 무엇입니까?빈 문자열을 인쇄 할 때 왜 0이 튀어 나옵니까?
display= (EditText) findViewById(R.id.editText1);}
//When button is clicked, display the text. How do I do this for the rest of my variables?
public void onClick(View v)
{
switch(v.getId())
{
case R.id.bOne: display.append("1"); break;
case R.id.bTwo: display.append("2"); break;
case R.id.bThree: display.append("3"); break;
case R.id.bFour: display.append("4"); break;
case R.id.bFive: display.append("5"); break;
case R.id.bSix: display.append("6"); break;
case R.id.bSeven: display.append("7"); break;
case R.id.bEight: display.append("8"); break;
case R.id.bNine: display.append("9"); break;
case R.id.bZero: display.append("0"); break;
case R.id.bPoint: display.append("."); break;
case R.id.bClear: display.setText("");
case R.id.bAdd: double counter = Double.toString(display);
//counter+=counter;
//display.setText(counter);
이클립스를 통해 안드로이드 프로젝트에 대한 자바의 caclulator를 프로그래밍하고있어
편집. 그리고 그것은 EditTExt 디스플레이입니다. 코드에서
추가 정보가 필요합니다. – vickirk
질문에 세부 사항을 추가해야합니다. 디스플레이 란 무엇입니까? 이 코드는 언제 실행됩니까? 또한 컨트롤의 텍스트를 인쇄하고 설정하는 것은 다른 작업입니다. – unholysampler
아마도 숫자 필드가 선택되었을 것입니다! –