Force down error in a calculation app(use if/if else)
<p>i have created an app that user places numbers into editexts and the app is making some calcs and displays a number..i have 7 lines with editexts .but the 7th editext is optional for the user to fill it(i added a checkbox and if the user select it the editext is visible,else its invisible..).i have a strange problem with my code and i would like to have your help..</p>

<p>firstly this is my code:</p>

<pre><code> apostoli.setOnClickListener(new OnClickListener() {

                private AlertDialog show;

                public void onClick(View arg0) {

                if ((vprosvasis.getText().toString() == " ")
                        || (vprosvasis.getText().length() == 0)
                        || (vprosvasis2.getText().toString() == " ")
                        || (vprosvasis2.getText().length() == 0)
                        || (vprosvasis3.getText().toString() == " ")
                        || (vprosvasis3.getText().length() == 0)
                        || (vprosvasis4.getText().toString() == " ")
                        || (vprosvasis4.getText().length() == 0)
                        || (vprosvasis5.getText().toString() == " ")
                        || (vprosvasis5.getText().length() == 0)
                        || (vprosvasis6.getText().toString() == " ")
                        || (vprosvasis6.getText().length() == 0)


                ) {

                                show = new AlertDialog.Builder(mContext).setTitle("Error")
                                                .setMessage("Symplirwste olous tous vathmous prosvasis")
                                                .setPositiveButton("OK", null).show();

                        } 


                    else if (((vprosvasis7.getText().toString() != " ")
                            || (vprosvasis7.getText().length() != 0)))
                {


                            float genikosvathmos = (float) (( new Float(vprosvasis.getText().toString())
                            + new Float(vprosvasis7.getText().toString())
                            + new Float(vprosvasis2.getText().toString())
                            + new Float(vprosvasis3.getText().toString())
                            + new Float(vprosvasis4.getText().toString())
                            + new Float(vprosvasis5.getText().toString()) + new Float(
                            vprosvasis6.getText().toString())) / 7);

                    float vprosvasisFloat = Float.parseFloat(vprosvasis.getText().toString());
                    float vprosvasisFloat2 = Float.parseFloat(vprosvasis2.getText().toString());
                    float vprosvasisFloat7 = Float.parseFloat(vprosvasis7.getText().toString());
                    float vprosvasisFloat5 = Float.parseFloat(vprosvasis5.getText().toString());

                    moria = (float) (((new Float((genikosvathmos * 8)+ (vprosvasisFloat * 1.3)+ (vprosvasisFloat2 * 0.7)) * 100)));
                    moria2 = (float) (((new Float((genikosvathmos * 8)+ (vprosvasisFloat7 * 1.3)+ (vprosvasisFloat5 * 0.7)) * 100)));

                    // Toast.makeText(thetiki.this, "Genikos vathmos"+moria ,
                    // Toast.LENGTH_SHORT).show();

                    // 1o pedio
                    show = new AlertDialog.Builder(mContext).setTitle("moria")
                    .setMessage(            "1o pedio:  " + moria + "\n2o pedio:  "
                                            + moria + "\n3o pedio:  " + moria
                                            + "\n4o pedio:  " + moria
                                            + "\n5o pedio:  "+moria2)
                            .setPositiveButton("OK", null).show();

                }




                    else if ((vprosvasis.getText().toString()!= " ")
                        || (vprosvasis.getText().length() != 0)
                        || (vprosvasis2.getText().toString() != " ")
                        || (vprosvasis2.getText().length() != 0)
                        || (vprosvasis3.getText().toString() != " ")
                        || (vprosvasis3.getText().length() != 0)
                        || (vprosvasis4.getText().toString() != " ")
                        || (vprosvasis4.getText().length() != 0)
                        || (vprosvasis5.getText().toString() != " ")
                        || (vprosvasis5.getText().length() != 0)
                        || (vprosvasis6.getText().toString() != " ")
                        || (vprosvasis6.getText().length() != 0)
                        &amp;&amp;((vprosvasis7.getText().toString()== " ")
                        || (vprosvasis7.getText().length() == 0))


                )

                {

                    float genikosvathmos = (float) ((new Float(vprosvasis
                            .getText().toString())
                            + new Float(vprosvasis2.getText().toString())
                            + new Float(vprosvasis3.getText().toString())
                            + new Float(vprosvasis4.getText().toString())
                            + new Float(vprosvasis5.getText().toString()) + new Float(
                            vprosvasis6.getText().toString())) / 6);


                                 float vprosvasisFloat = Float.parseFloat(vprosvasis.getText().toString());
                                 float vprosvasisFloat2 = Float.parseFloat(vprosvasis2.getText().toString());


                                 moria=(float) (((new Float ((genikosvathmos*8)+(vprosvasisFloat * 1.3)+(vprosvasisFloat2 * 0.7))*100)));       

                                // Toast.makeText(thetiki.this, "Genikos vathmos"+moria , Toast.LENGTH_SHORT).show();

                           show = new AlertDialog.Builder(mContext).setTitle("moria")
                             .setMessage("1o pedio:  "+moria+"\n2o pedio:  "+moria+"\n3o pedio:  "+moria+"\n4o pedio:  "+moria+"\n5o pedio:  -")
                             .setPositiveButton("OK", null).show();

                        } 

                } 

        });
</code></pre>

<p><code>vprosvasis,vprosvasis2</code>..etc is the number into the editText.i have used 3 if/else.the first checks if the 6 first editexts are empty and if no there is an alert.the second would like to check if the <code>vprosvasis7</code> is not empty and then make a calculation.and finally,the third one want to check if the  <code>vprosvasis7</code> is used and then make a new calc..this is not working..specifically,the first if is working,the second works two,but if i havent filled the 7th editext,the 3rd if stacks and forces down my app..</p>

<p>your help would be really very helpfull..</p>

<p>EDIT</p>

<p>LogCat when the 7th editext is empty and i press the btn 'apostoli'</p>

<pre><code>02-23 23:51:27.234: ERROR/AndroidRuntime(5739): FATAL EXCEPTION: main
02-23 23:51:27.234: ERROR/AndroidRuntime(5739): java.lang.NumberFormatException: 
02-23 23:51:27.234: ERROR/AndroidRuntime(5739):     at org.apache.harmony.luni.util.FloatingPointParser.parseFloat(FloatingPointParser.java:305)
02-23 23:51:27.234: ERROR/AndroidRuntime(5739):     at java.lang.Float.parseFloat(Float.java:291)
02-23 23:51:27.234: ERROR/AndroidRuntime(5739):     at java.lang.Float.&lt;init&gt;(Float.java:111)
02-23 23:51:27.234: ERROR/AndroidRuntime(5739):     at kostas.menu.moria.thetiki$8.onClick(thetiki.java:396)
02-23 23:51:27.234: ERROR/AndroidRuntime(5739):     at android.view.View.performClick(View.java:2461)
02-23 23:51:27.234: ERROR/AndroidRuntime(5739):     at android.view.View$PerformClick.run(View.java:8888)
02-23 23:51:27.234: ERROR/AndroidRuntime(5739):     at android.os.Handler.handleCallback(Handler.java:587)
02-23 23:51:27.234: ERROR/AndroidRuntime(5739):     at android.os.Handler.dispatchMessage(Handler.java:92)
02-23 23:51:27.234: ERROR/AndroidRuntime(5739):     at android.os.Looper.loop(Looper.java:123)
02-23 23:51:27.234: ERROR/AndroidRuntime(5739):     at android.app.ActivityThread.main(ActivityThread.java:4627)
02-23 23:51:27.234: ERROR/AndroidRuntime(5739):     at java.lang.reflect.Method.invokeNative(Native Method)
02-23 23:51:27.234: ERROR/AndroidRuntime(5739):     at java.lang.reflect.Method.invoke(Method.java:521)
02-23 23:51:27.234: ERROR/AndroidRuntime(5739):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
02-23 23:51:27.234: ERROR/AndroidRuntime(5739):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
02-23 23:51:27.234: ERROR/AndroidRuntime(5739):     at dalvik.system.NativeStart.main(Native Method)
02-23 23:51:27.249: WARN/ActivityManager(2944):   Force finishing activity kostas.menu.moria/.thetiki
02-23 23:51:27.300: INFO/(2944): dumpmesg &gt; "/data/log/dumpstate_app_error.log"
</code></pre>
