title: Is there a way for EditText in android to take minus value and convert it to double?
body: <blockquote>
  <p>I have an EditText with the type as numberDecimal|numberSigned. I convert this value to double,
  when I enter fractional numbers it works fine, but when I enter minus/negative numbers, it crashes.</p>
  </blockquote>
  <pre><code>   identity=(Button) findViewById(R.id.identification_color);
                  if(free_height.getText().toString().trim().length() != 0){
                  double  middleinner=305;
                  double outer=370;
                  double x1= new Double(free_height.getText().toString());
  
                  if (x1==middleinner)
                  {
                      identity.setBackgroundColor(Color.rgb(0,128,0));
  
                  } ....
  </code></pre>
  <blockquote>
  <p>Error Log:</p>
  </blockquote>
  <pre><code>22021-05-06 11:49:17.059 12610-12610/com.example.springtester E/AndroidRuntime: FATAL EXCEPTION: main
  Process: com.example.springtester, PID: 12610
  java.lang.NumberFormatException: For input string: &quot;-&quot;
      at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:2043)
      at sun.misc.FloatingDecimal.parseDouble(FloatingDecimal.java:110)
      at java.lang.Double.parseDouble(Double.java:538)
      at java.lang.Double.&lt;init&gt;(Double.java:608)
      at com.example.springtester.MainActivity$1.afterTextChanged(MainActivity.java:67)
      at android.widget.TextView.sendAfterTextChanged(TextView.java:11662)
      at android.widget.TextView$ChangeWatcher.afterTextChanged(TextView.java:14943)
      at android.text.SpannableStringBuilder.sendAfterTextChanged(SpannableStringBuilder.java:1287)
      at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:587)
      at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:517)
      at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:38)
      at android.view.inputmethod.BaseInputConnection.replaceText(BaseInputConnection.java:849)
      at android.view.inputmethod.BaseInputConnection.setComposingText(BaseInputConnection.java:618)
      at com.android.internal.view.IInputConnectionWrapper.executeMessage(IInputConnectionWrapper.java:393)
      at com.android.internal.view.IInputConnectionWrapper$MyHandler.handleMessage(IInputConnectionWrapper.java:89)
      at android.os.Handler.dispatchMessage(Handler.java:107)
      at android.os.Looper.loop(Looper.java:237)
      at android.app.ActivityThread.main(ActivityThread.java:8154)
      at java.lang.reflect.Method.invoke(Native Method)
      at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:496)
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1100)
  </code></pre>