I am trying to add two numbers together from EditText fields. So far I have the code below that I believe converts the EditText field 'pos1_deg' & 'pos2_deg' into integers deg1 & deg2.
deg1 = Integer.parseInt(pos1_deg.getText().toString());
deg2 = Integer.parseInt(pos2_deg.getText().toString());
I could then do the following to add them together
degSum = deg1 + deg2
And then the degSum register holds the sum of deg1 & 2. Is this correct so far?
Then to output back to the 'result' EditText I need to change the integer degSum into a string. I thought the correct way was to use the code below:
result.setText(degSum.toString());
However I get an 'Cannot invoke toString() on the primitive type int' error. What am I doing wrong?
Many thanks for any help