title: EditText to int using Integer.parseInt
body: <p>I'm new to programming and Android.  I'm making my best attempt at a simple app and I'm stuck!</p>
  
  <p>I have two editTexts (set to accept numbers only) and a button.  The idea is to display the sum of the two user inputs when the button is pressed.  However, my app stops working and force closes when I click the button in the emulator.</p>
  
  <p>Any help would be greatly appreciated.</p>
  
  <pre><code>@Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
  
      setContentView(R.layout.activity_prevailing_torque);
      Button calculatePrevailing = (Button) findViewById(R.id.button_calculatePrevailing);
  
  
      calculatePrevailing.setOnClickListener(new View.OnClickListener() {
          public void onClick(View v) {
              TextView prevailingSetting = (TextView) findViewById(R.id.textViewSetting);
              EditText editTextPrevailing = (EditText) findViewById(R.id.editTextPrevailing);
              EditText editTextRecommended = (EditText) findViewById(R.id.editTextReccomended);
  
              int p = Integer.parseInt(editTextPrevailing.getText().toString());
              int r = Integer.parseInt(editTextRecommended.getText().toString());
  
              prevailingSetting.setText(r+p);
          }
      });
  }
  </code></pre>
  
  <p>I've looked at several similar questions on here but I haven't been able to find anything that I can implement further than what I have already done.  But I am probably looking in the wrong places.
  Thanks!</p>