title: Displaying integer values in toast message
body: <p>I am trying to create a BMI Application in Android 4.3. There are no compilation errors, but when I start running it on the emulator, I am getting the message - "Unfortunately, BMI has stopped." I can't understand, Where did I went wrong. Can any one please help me out? My java file is as follows - </p>
  
  <pre><code>package com.example.bmi;
  
  import android.os.Bundle;
  import android.app.Activity;
  import android.view.Menu;
  import android.view.View;
  import android.view.View.OnClickListener;
  import android.widget.Button;
  import android.widget.EditText;
  import android.widget.Toast;
  
   public class MainActivity extends Activity {
     double bmi;
  @Override
          protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  
      EditText e1=(EditText)findViewById(R.id.editText1);
      EditText e2=(EditText)findViewById(R.id.editText3);
      double d1 = Double.parseDouble(e1.getText().toString());
      double d2 = Double.parseDouble(e2.getText().toString());
      bmi = ( d2 / (d1*d1));
  
  }
        public void showMessage(View v)
         {    
  
         Toast.makeText(getApplicationContext(), "Your BMI is " + bmi,                Toast.LENGTH_SHORT).show();
  
              }
          @Override
           public boolean onCreateOptionsMenu(Menu menu) {
      // Inflate the menu; this adds items to the action bar if it is present.
      getMenuInflater().inflate(R.menu.main, menu);
      return true;
           }
  
                  }
  </code></pre>
  
  <p>And the xml file is as follows - 
         </p>
  
  <pre><code>&lt;TextView
      android:id="@+id/textView1"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_alignParentLeft="true"
      android:layout_alignParentTop="true"
      android:layout_marginLeft="20dp"
      android:layout_marginTop="21dp"
      android:text="Height(m)"
      android:textAppearance="?android:attr/textAppearanceMedium" /&gt;
  
  &lt;TextView
      android:id="@+id/textView2"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_alignLeft="@+id/textView1"
      android:layout_below="@+id/textView1"
      android:layout_marginTop="33dp"
      android:text="Weight(kg)"
      android:textAppearance="?android:attr/textAppearanceMedium" /&gt;
  
  &lt;EditText
      android:id="@+id/editText2"
      android:layout_width="110dp"
      android:layout_height="wrap_content"
      android:layout_alignBottom="@+id/textView2"
      android:ems="10" /&gt;
  
  &lt;TextView
      android:id="@+id/textView3"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_below="@+id/editText2"
      android:layout_centerHorizontal="true"
      android:layout_marginTop="75dp"
      android:text="@string/condition"
      android:textAppearance="?android:attr/textAppearanceSmall" /&gt;
  
  &lt;Button
      android:id="@+id/button1"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_alignParentBottom="true"
      android:layout_centerHorizontal="true"
      android:layout_marginBottom="98dp"
      android:text="Calculate" 
      android:onClick="showMessage"/&gt;
  
  &lt;EditText
      android:id="@+id/editText1"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_alignBaseline="@+id/textView1"
      android:layout_alignBottom="@+id/textView1"
      android:layout_marginLeft="47dp"
      android:layout_toRightOf="@+id/editText2"
      android:ems="10"
      android:inputType="number" &gt;
  
      &lt;requestFocus /&gt;
  &lt;/EditText&gt;
  
  &lt;EditText
      android:id="@+id/editText3"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_alignBaseline="@+id/textView2"
      android:layout_alignBottom="@+id/textView2"
      android:layout_alignLeft="@+id/editText1"
      android:ems="10"
      android:inputType="number" /&gt;
  
     &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>This is how I have done my application.  </p>
  
  <p>Thanks in advance.</p>