und zwei EditText -Felder 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));
}
Confused Cow