试图让我的代码工作但似乎崩溃了。 谁能帮我?提前谢谢:-)
EditText HbA1c;
TextView result;
Button button;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
HbA1c = (EditText) findViewById(R.id.HbA1c);
button = (Button) findViewById(R.id.button);
result = (TextView) findViewById(R.id.result);
}
public void onButtonClick(View view) {
int num = Integer.parseInt(HbA1c.getText().toString());
if (HbA1c == 6.5) {
result.setText("DM");
} else {
result.setText("not DM");
}
}