• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Help app crash after button click

In my application below are codes my app crash on button click

protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

Button calculate = (Button) findViewById(R.id.button1);

calculate.setOnClickListener(new OnClickListener() {

public void onClick(View view) {

EditText ht = (EditText) findViewById(R.id.height);
EditText wt = (EditText) findViewById(R.id.weight);
TextView tv7 = (TextView) findViewById(R.id.textView7);
Double x = Double.parseDouble(ht.getText().toString());

Double y = Double.parseDouble(wt.getText().toString());

String z = Double.toString(Math.round( y / (x / 100) * (x / 100)));

if (((ht.getText().toString().isEmpty()) && (wt.getText().toString().isEmpty())) || (wt.getText().toString().isEmpty()) || (ht.getText().toString().isEmpty())) {

tv7.setText("Please enter valid value");
}
}
pl help.
 
Back
Top Bottom