title: java.lang.NumberFormatException: Invalid double: "" at java.lang.StringToReal.invalidReal
body: <p>Hi I'm taking a value from edittext and converting displaying that value in other text but getting run time error java.lang.NumberFormatException: Invalid double: "".at java.lang.StringToReal.invalidReal. In my setAdapter its taking only franheit that means only todetails. I didn't understand where the bug is</p>
  
  <pre><code>public class UniqueConverter extends Fragment {
  
      private Spinner fromDetails, toDetails;
      private EditText fromInput, toInput;
  @Override
      public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
          View view = inflater.inflate(R.layout.fragment_uniquelayout, container, false);
  onInitVies(view);
          int position = getArguments().getInt("position");
          String ifrom,rto;
          Double inp;
          double out = 0;
  
          switch (position) {
              case 0:
                  setAdapter(temperatureform, "Celsius", "Fahrenheit");
                  ifrom = (String) fromDetails.getSelectedItem();
                  rto = (String) toDetails.getSelectedItem();
                  inp = Double.valueOf(fromInput.getText().toString());
                  TemperatureConverter con = new TemperatureConverter();
                  TemperatureConverter.Units fromUnit = TemperatureConverter.Units.fromString(ifrom);
                  TemperatureConverter.Units toUnit = TemperatureConverter.Units.fromString(rto);
                  out = con.TemperatureConvert(fromUnit,toUnit,inp);
                  break;
              case 1:
                  setAdapter(weightform, "Kilograms", "Grams");
                  ifrom = (String) fromDetails.getSelectedItem();
                  rto = (String) toDetails.getSelectedItem();
                  inp = Double.valueOf(fromInput.getText().toString());
                  WeightConverter converter = new WeightConverter();
                  WeightConverter.Inus fromInus = WeightConverter.Inus.fromString(ifrom);
                  WeightConverter.Inus toInus = WeightConverter.Inus.fromString(rto);
                  out = converter.WeightConvert(fromInus, toInus, inp);
                  break;
  
    final double finalOut = out;
          fromInput.addTextChangedListener(new TextWatcher() {
                  @Override
                  public void beforeTextChanged(CharSequence s, int start, int count, int after) {
  
                  }
  
                  @Override
                  public void onTextChanged(CharSequence s, int start, int before, int count) {
  
                  }
  
                  @Override
                  public void afterTextChanged(Editable s) {
  
                      if (!fromInput.getText().toString().equals(""))
                      {
                          toInput.setText(String.valueOf(finalOut));
                      }
                      else
                      {
                          toInput.setText("");
                      }
  
                  }
              });
  
  
              return view;
  
      }
  
  
      private void setAdapter(String[] spinnerItems, String fromDefaultText, String toDefaultText) {
          fromDetails.setAdapter(new CustomSpinnerAdapter(getContext(), R.layout.spinner_item, spinnerItems, fromDefaultText));
          toDetails.setAdapter(new CustomSpinnerAdapter(getContext(), R.layout.spinner_item, spinnerItems, toDefaultText));
      }
  
      private void onInitVies(View view) {
          fromDetails = (Spinner) view.findViewById(R.id.fromSpinner);
          toDetails = (Spinner) view.findViewById(R.id.toSpinner);
  
          fromInput = (EditText) view.findViewById(R.id.fromInput);
          toInput = (EditText) view.findViewById(R.id.toInput);
      }
  </code></pre>
  
  <p>logcat:</p>
  
  <pre><code> Process: com.cloudicalabs.converters, PID: 8063
  03-16 03:47:54.078 8063-8063/com.cloudicalabs.converters E/AndroidRuntime: java.lang.NumberFormatException: Invalid double: ""
  03-16 03:47:54.078 8063-8063/com.cloudicalabs.converters E/AndroidRuntime:     at java.lang.StringToReal.invalidReal(StringToReal.java:63)
  03-16 03:47:54.078 8063-8063/com.cloudicalabs.converters E/AndroidRuntime:     at java.lang.StringToReal.parseDouble(StringToReal.java:267)
  03-16 03:47:54.078 8063-8063/com.cloudicalabs.converters E/AndroidRuntime:     at java.lang.Double.parseDouble(Double.java:301)
  03-16 03:47:54.078 8063-8063/com.cloudicalabs.converters E/AndroidRuntime:     at java.lang.Double.valueOf(Double.java:338)
  03-16 03:47:54.078 8063-8063/com.cloudicalabs.converters E/AndroidRuntime:     at com.cloudicalabs.converters.fragments.UniqueConverter.onCreateView(UniqueConverter.java:74)
  03-16 03:47:54.078 8063-8063/com.cloudicalabs.converters E/AndroidRuntime:     at android.support.v4.app.Fragment.performCreateView(Fragment.java:1962)
  03-16 03:47:54.078 8063-8063/com.cloudicalabs.converters E/AndroidRuntime:     at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1067)
  03-16 03:47:54.078 8063-8063/com.cloudicalabs.converters E/AndroidRuntime:     at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1248)
  03-16 03:47:54.078 8063-8063/com.cloudicalabs.converters E/AndroidRuntime:     at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:738)
  </code></pre>