我做了这个开关声明,当我按下按钮线时该部分工作,当我按下输入一次有效但但当我再次按它时,它不是为什么?
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
OutPutConversion Out = new OutPutConversion();
DrawingTools AddL = new DrawingTools();
EditText cl = (EditText) findViewById(R.id.CL);
TextView info = (TextView) findViewById(R.id.info);
int n = 0;
switch (v.getId()) {
case R.id.LineVL:
info.setText("Enter x,y,z For Point 1");
break;
case R.id.Enter:
switch (n) {
case (0):
String Input1 = cl.getText().toString();
AddL.AddLine(Input1);
info.setText("Enter x,y,z For Point 2");
n++;
break;
case (1):
String Input2 = cl.getText().toString();
AddL.AddLine(Input2);
info.setText("Press Enter Again TO See Results");
n++;
break;
case (2):
n = 0;
Out.Out();
break;
}
答案 0 :(得分:1)
删除int n=0;
外部功能。截至目前,每次都将值重新设置为0.