title: Android Number Format Exception using EditText
body: <p>I have a simple process running</p>
  
  <p>Put simply the user inputs a number into an EditText, picks Radio Button and then presses calculate. The radio buttons are connected to if statements that in turn direct towards floats that are returned replacing the number shown in the EditText.  However it appears that if the calculate button is pressed before any numbers are entered then a number format exception occours causing the app to crash.</p>
  
  <p>For now I will enter a default value into the EditText to decrease the chances of this happening, but i was wondering if there was a way to avoid an exception all together using something like an if statement or something similar </p>
  
  <p>here is some example code</p>
  
  <pre><code>import android.app.Activity;
  import android.os.Bundle;
  import android.view.View;
  import android.widget.EditText;
  import android.widget.RadioButton;
  
  import com.admob.android.ads.AdManager;
  import com.admob.android.ads.AdView;
  import com.medialets.android.analytics.MMAnalyticsManager;
  
  public class Area extends Activity {
      private EditText text9;
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.area);
              text9 = (EditText)findViewById(R.id.EditText09);
  
      public void myClickHandler09(View view){
  switch (view.getId()) {
  case R.id.Button09:
      RadioButton SeveralRadioButtons = (RadioButton) findViewById (R.id.RadioButton901);
      float inputValue = Float.parseFloat(text9.getText().toString());
      String checkValue = String.valueOf(inputValue);
  
      if (checkValue.equals("")){
          text9.setText(String.valueOf(""));
     } else {
  
       if (SeveralRadioButtons.isChecked())  {
              text9.setText(String
                      .valueOf(conversionfactor(inputValue)));
     }
         break;
  }}}
  
  private double conversionfactor(float f){
          return f * 6.4516;
      }
  </code></pre>
  
  <p>Where 
       (SeveralRadioButtons)
  is called there are in fact several radio buttons and an if statement and private double for each one respectively </p>
  
  <p>As you can see I have already made an attempt at fixing the problem but the number format exception still appears.</p>