Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

and two editText fields in android studio

public void calNumbers(View view) {
    EditText text = (EditText)findViewById(R.id.edit_number1);
    String value = text.getText().toString();       

    EditText text2 = (EditText)findViewById(R.id.edit_number2);
    String value2 = text2.getText().toString();              

    TextView answer = (TextView) findViewById(R.id.answer);      
    long l1 = Long.parseLong(text);
    long l2 = Long.parseLong(text2);

    long result = l1 + l2;
    answer.setText(Long.toString(result));
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #editText #fields #android #studio
ADD COMMENT
Topic
Name
9+8 =