1
I want to take two values out of two EditText
and put the result of these two values into one TextView
. I made that code but this giving error
editPecaBoas = findViewById(R.id.editPecaBoas);
editPecaRuins = findViewById(R.id.editPecaRuins);
public void sumParts() {
TextWatcher watcher = new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void afterTextChanged(Editable s) {
int a = Integer.parseInt(editPecaBoas.getText().toString());
int b = Integer.parseInt(editPecaRuins.getText().toString());
int i = a + b;
String t = String.valueOf(i);
textViewResult.setText(t);
}
};
That is the mistake
java.lang.NumberFormatException: For input string: ""