Android Activity Crash
<p>I made a simple car mileage calculator. </p>

<pre><code>package com.android.carmanager;

import com.android.carmanager.CarManagerActivity;
import android.os.Bundle;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.view.View;


public class MileageCalculator extends CarManagerActivity {
private EditText input1;
private EditText input2;
private EditText input3;
private TextView distance;
private TextView showmileage;


  @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.mileagecalculator);

        input1 = (EditText) findViewById(R.id.input1);
        input2 = (EditText) findViewById(R.id.input2);
        input3 = (EditText) findViewById(R.id.input3);
        distance = (TextView) findViewById(R.id.distance);
        showmileage = (TextView) findViewById(R.id.showmileage);

        Button calculatebutton = (Button) findViewById(R.id.calculatebutton);

        double totaldistance = new Double(input2.getText().toString()) - new Double(input1.getText().toString());
        distance.setText(Double.toString(totaldistance));

        calculatebutton.setOnClickListener(new OnClickListener() {

            public void onClick(View arg0) {

                double result = new Double(distance.getText().toString()) / new Double(input3.getText().toString());
                showmileage.setText(Double.toString(result));

            }

    });


}
}
</code></pre>

<p>And the mileagecalculator .xml file is here:</p>

<pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" android:orientation="vertical"&gt;

    &lt;TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/InitialOdo"
        android:padding="10dp" android:textStyle="bold"/&gt;

    &lt;EditText
        android:id="@+id/input1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:inputType="number"
        android:padding="10dp" &gt;


    &lt;/EditText&gt;

    &lt;TextView
        android:id="@+id/textView2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/FinalOdo"
        android:padding="10dp" 
        android:textStyle="bold"/&gt;

    &lt;EditText
        android:id="@+id/input2"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:inputType="number"
        android:padding="10dp" /&gt;

    &lt;TextView
        android:id="@+id/textView3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:padding="10dp"
        android:text="@string/distance"
        android:textStyle="bold" /&gt;

    &lt;TextView
        android:id="@+id/distance"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:padding="10dp"/&gt;

    &lt;TextView
        android:id="@+id/textView4"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/fuelrefilled"
        android:padding="10dp" android:textStyle="bold"/&gt;

    &lt;EditText
        android:id="@+id/input3"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:inputType="number"
        android:padding="10dp" /&gt;

    &lt;Button
        android:id="@+id/calculatebutton"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:text="@string/CalcMileage" /&gt;

    &lt;TextView
        android:id="@+id/showmileage"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="center_vertical|center_horizontal" /&gt;

&lt;/LinearLayout&gt;
</code></pre>

<p>Whenever I try to run this simple mileage calculator activity, the app simple crashes returns to the home screen. I encounter the following errors in the log cat. </p>

<pre><code>05-22 17:05:09.743: W/dalvikvm(542): threadid=1: thread exiting with uncaught exception (group=0x409c01f8)
05-22 17:05:09.793: E/AndroidRuntime(542): FATAL EXCEPTION: main
05-22 17:05:09.793: E/AndroidRuntime(542): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.android.carmanager/com.android.carmanager.MileageCalculator}: java.lang.NumberFormatException: Invalid double: ""
05-22 17:05:09.793: E/AndroidRuntime(542):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956)
05-22 17:05:09.793: E/AndroidRuntime(542):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
05-22 17:05:09.793: E/AndroidRuntime(542):  at android.app.ActivityThread.access$600(ActivityThread.java:123)
05-22 17:05:09.793: E/AndroidRuntime(542):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
05-22 17:05:09.793: E/AndroidRuntime(542):  at android.os.Handler.dispatchMessage(Handler.java:99)
05-22 17:05:09.793: E/AndroidRuntime(542):  at android.os.Looper.loop(Looper.java:137)
05-22 17:05:09.793: E/AndroidRuntime(542):  at android.app.ActivityThread.main(ActivityThread.java:4424)
05-22 17:05:09.793: E/AndroidRuntime(542):  at java.lang.reflect.Method.invokeNative(Native Method)
05-22 17:05:09.793: E/AndroidRuntime(542):  at java.lang.reflect.Method.invoke(Method.java:511)
05-22 17:05:09.793: E/AndroidRuntime(542):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
05-22 17:05:09.793: E/AndroidRuntime(542):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
05-22 17:05:09.793: E/AndroidRuntime(542):  at dalvik.system.NativeStart.main(Native Method)
05-22 17:05:09.793: E/AndroidRuntime(542): Caused by: java.lang.NumberFormatException: Invalid double: ""
05-22 17:05:09.793: E/AndroidRuntime(542):  at java.lang.StringToReal.invalidReal(StringToReal.java:63)
05-22 17:05:09.793: E/AndroidRuntime(542):  at java.lang.StringToReal.parseDouble(StringToReal.java:248)
05-22 17:05:09.793: E/AndroidRuntime(542):  at java.lang.Double.parseDouble(Double.java:295)
05-22 17:05:09.793: E/AndroidRuntime(542):  at java.lang.Double.&lt;init&gt;(Double.java:136)
05-22 17:05:09.793: E/AndroidRuntime(542):  at com.android.carmanager.MileageCalculator.onCreate(MileageCalculator.java:30)
05-22 17:05:09.793: E/AndroidRuntime(542):  at android.app.Activity.performCreate(Activity.java:4465)
05-22 17:05:09.793: E/AndroidRuntime(542):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
05-22 17:05:09.793: E/AndroidRuntime(542):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
05-22 17:05:09.793: E/AndroidRuntime(542):  ... 11 more
05-22 17:05:10.033: I/dalvikvm(542): threadid=3: reacting to signal 3
05-22 17:05:10.043: I/dalvikvm(542): Wrote stack traces to '/data/anr/traces.txt'
05-22 17:05:10.493: I/dalvikvm(542): threadid=3: reacting to signal 3
05-22 17:05:10.563: I/dalvikvm(542): Wrote stack traces to '/data/anr/traces.txt'
05-22 17:05:12.313: I/Process(542): Sending signal. PID: 542 SIG: 9
</code></pre>

<p>I have restarted the eclipse, avd several times.
Cleaned the build and deleted the R.java File several times, but Still I am stuck here and don't know what to do next. </p>
