title: NumberFormatException in EditText
body: <p>I have a TextView that calculates two EditText. It works as long as a digit is in the EditText but as soon all numbers are deleted I get this error</p>
  
  <p>java.lang.NumberFormatException: unable to parse '' as integer</p>
  
  <p>I understand why I'm getting the error but I cant figure out how to fix it. I've googled and searched for answers on this site but they don't seem to work for my situation. I've tried to catch the NumberFormatException but I cant do it. Any help?</p>
  
  <pre><code>items = (EditText)findViewById(R.id.items);
  itemcost = (EditText)findViewById(R.id.itemcost);
  inventoryvalue = (TextView)findViewById(R.id.inventoryvalue);
  
  
  TextWatcher textWatcher = new TextWatcher() {
  public void afterTextChanged(Editable s) {
  calculateResult();
  }
  public void beforeTextChanged(CharSequence s, int start, int count, int after){}
  public void onTextChanged(CharSequence s, int start, int before, int count){}
  };
  
  items.addTextChangedListener(textWatcher);
  itemcost.addTextChangedListener(textWatcher);
  }
  
  private void calculateResult() throws NumberFormatException {
  
  String s1 = items.getText().toString();
      String s2 = itemcost.getText().toString();
      int value1 = Integer.parseInt(s1);
      int value2 = Integer.parseInt(s2);
      int result = value1 * value2; {
  
  // Calculates the result
  result = value1 * value2;
  // Displays the calculated result
  inventoryvalue.setText(String.valueOf(result));             
  }
  </code></pre>