title: Button pressing causes app crash
body: <p>In eclipse i tried making a calculator. I had 2 separate text fields for two numbers and addition subtraction buttons. When i press add or sub button without entering values app crashes. Is there any possible way out? </p>
  
  <pre><code>public void onClick(View v) {
      // TODO Auto-generated method stub
      String l1= et1.getText().toString();
      String l2= et2.getText().toString();
      int a=0, b=0;
  
      double result=0.0;
      a=Integer.parseInt(l1);
      b=Integer.parseInt(l2);
  
      switch(v.getId())
      {
      case R.id.b1:
  
          result=a+b;
          break;
      case R.id.b2:
          result=a-b;
          break;
      case R.id.b3:
          result = a*b;
          break;
      case R.id.b4:
          if(b==0)
          {
              open("Cannot Divide By zero");
          }
          else result = a/b;
          break;
      }
      et3.setText(Double.toString(result));
  }
  </code></pre>