App crashes


Need help. My code crashes everytime I enter the data. My code is suppose to say that you have this disease once the value is more than 6.5.

Whats wrong with my code? Thanks in advance

public class MainActivity extends AppCompatActivity {

    EditText HbA1c;
    TextView result;
    Button button;

    protected void onCreate(Bundle savedInstanceState) {

        HbA1c = (EditText) findViewById(;
        button = (Button) findViewById(;
        result = (TextView) findViewById(;

    public void onButtonClick() {

        double num = Double.parseDouble(HbA1c.getText().toString());

        if (num == 6.5 && num > 6.5) {

            result.setText("You may have DM");

        } else
            result.setText("You may not have DM");




public void onButtonClick() { onButtonClick();