App crashes when pressing button
<p>I'm making an app and it keeps crashing when pressing the button. The button needs to call the calculate function. That works :) but the other things dont work. All the <code>EditText</code> Fields are inputs and the <code>EditText10</code> is an output field. But it also needs to work when you dont fill in every input field.</p>

<pre><code>@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    //Bind the EditText views

    EindCijfer = (EditText)findViewById(R.id.EditText10);
    Cijfer1 = (EditText)findViewById(R.id.EditText01);
    Cijfer2 = (EditText)findViewById(R.id.editText1);
    Cijfer3 = (EditText)findViewById(R.id.EditText02);
    Cijfer4 = (EditText)findViewById(R.id.EditText04);
    Cijfer5 = (EditText)findViewById(R.id.EditText03);
    Cijfer6 = (EditText)findViewById(R.id.EditText11);
    Weging1 = (EditText)findViewById(R.id.EditText08);
    Weging2 = (EditText)findViewById(R.id.EditText09);
    Weging3 = (EditText)findViewById(R.id.EditText05);
    Weging4 = (EditText)findViewById(R.id.EditText06);
    Weging5 = (EditText)findViewById(R.id.EditText07);
    Weging6 = (EditText)findViewById(R.id.EditText12);


}

@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;
}

EditText EindCijfer;
EditText Cijfer1;
EditText Weging1;
EditText Cijfer2;
EditText Weging2;
EditText Cijfer3;
EditText Weging3;
EditText Cijfer4;
EditText Weging4;
EditText Cijfer5;
EditText Weging5;
EditText Cijfer6;
EditText Weging6;



public void Calculate(View v){
    // Wanneer je op de button drukt
    Bereken();
}

public void Bereken() {
    Double value1 = Double.parseDouble(Cijfer1.getText().toString());
    Double value2 = Double.parseDouble(Cijfer2.getText().toString());
    Double value3 = Double.parseDouble(Cijfer3.getText().toString());
    Double value4 = Double.parseDouble(Cijfer4.getText().toString());
    Double value5 = Double.parseDouble(Cijfer5.getText().toString());
    Double value6 = Double.parseDouble(Cijfer6.getText().toString());
    Double value7 = Double.parseDouble(Weging1.getText().toString());
    Double value8 = Double.parseDouble(Weging2.getText().toString());
    Double value9 = Double.parseDouble(Weging3.getText().toString());
    Double value10 = Double.parseDouble(Weging4.getText().toString());
    Double value11 = Double.parseDouble(Weging5.getText().toString());
    Double value12 = Double.parseDouble(Weging6.getText().toString());
    // Bereken
    if (value6 == null){
        if (value5 == null){
            if (value4 == null){
                if (value3 == null){
                    if (value2 == null){
                        if (value1 == null){
                            // Do nothing
                        }
                        // Set output to Cijfer 1
                        Double calculatedValue = (value1);
                        // Output
                        EindCijfer.setText(calculatedValue.toString());
                    }
                    // Calculate Average over Cijfer 1 and 2
                    Double calculatedValue = ((value1*value7)+(value2*value8))/(value7+value8);
                    // Output
                    EindCijfer.setText(calculatedValue.toString());
                }
                // Calculate Average over Cijfer 1 and 2 and 3
                Double calculatedValue = ((value1*value7)+(value2*value8)+(value3*value9))/(value7+value8+value9);
                // Output
                EindCijfer.setText(calculatedValue.toString());
            }
            // Calculate Average over Cijfer 1 and 2 and 3 and 4
            Double calculatedValue = ((value1*value7)+(value2*value8)+(value3*value9)+(value4*value10))/(value7+value8+value9+value10);
            // Output
            EindCijfer.setText(calculatedValue.toString());
        }
        // Calculate Average over Cijfer 1 and 2 and 3 and 4 and 5
        Double calculatedValue = ((value1*value7)+(value2*value8)+(value3*value9)+(value4*value10)+(value5*value11))/(value7+value8+value9+value10+value11);
        // Output
        EindCijfer.setText(calculatedValue.toString());
    }
    // Calculate Average over Cijfer 1 and 2 and 3 and 4 and 5 and 6
    Double calculatedValue = ((value1*value7)+(value2*value8)+(value3*value9)+(value4*value10)+(value5*value11)+(value6*value12))/(value7+value8+value9+value10+value11+value12);
    // Output
    EindCijfer.setText(calculatedValue.toString());
}

}
</code></pre>
