I have a toy app that contains:editText1 for entering a number. Uses inputType of number.editText2 for entering a second number. Uses inputType of number.adderButton for triggering addition.textVeiw  for displaying the result of the addition.I know:The naming could be betterI should check for overflow/underflow on the addition and elsewhere. This code is working for simple cases.  public void adder_click(View view) {        EditText et1 = (EditText) findViewById(R.id.editText1);        EditText et2 = (EditText) findViewById(R.id.editText2);        Integer s = Integer.valueOf(et1.getText().toString()) + Integer.valueOf(et2.getText().toString());        TextView tv = (TextView) findViewById(R.id.textView);        tv.setText(s.toString());       }Is there a more direct way of reading the values and performing the addition?
Using Java to Add the Contents of two EditText views in Android
java;android
No, that's as direct as it's going to be with an EditText (you could try it with a NumberPicker), as you cannot directly get an integer from it.But you could extract the process into its own method:private int getInt(EditText editText) throws NumberFormatException {    return Integer.valueOf(editText.getText().toString());}If you also use what @mleyfman said, your code would look like this:public void adder_click() {    tv.setText(getInt(et1) + getInt(et2));   }Also note that I removed the method argument, as it's unused.And for the record, yes, the naming isn't very good. It's easy to just leave the names as editText1, editText2, etc, but this will get confusing really fast (as will tv, et1, et2, etc). Also, use camelCase (adder_click should be adderClick)