title: try catch no alert box android
body: <p>I am trying to show a alert box in my app when numberformat exception occurs but for some reason the app crashes</p>
  
  <p>add.setOnClickListener(new View.OnClickListener() {</p>
  
  <pre><code>        public void onClick(View arg0) {
              // TODO Auto-generated method stub
  
              try {
  
                  preRes = new Double(field1.getText().toString());
                  lastCommand = "+";
                  field1.setText("");
                  count = 0;
  
              } catch (NumberFormatException e) {    
  
  
                  show = new AlertDialog.Builder(mContext)
                  .setTitle("Error")
                  .setMessage("no inputs").setPositiveButton("OK", null).show();
  
              }
  
          }
      });
  </code></pre>