I have used below code,
textareaA.addTextChangedListener(new TextWatcher() {
@Override
public void afterTextChanged(Editable arg0) {
}
@Override
public void beforeTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) {
}
@Override
public void onTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) {
double val = Double.parseDouble(textareaA.getText().toString());
textareaB.setText(String.valueOf(val/10000));
}
});
textareaB.addTextChangedListener(new TextWatcher() {
@Override
public void afterTextChanged(Editable arg0) {
}
@Override
public void beforeTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) {
}
@Override
public void onTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) {
double val = Double.parseDouble(textareaB.getText().toString());
textareaA.setText(String.valueOf(val*10000));
}
});
If I type a value in any EditTexts, it crashes and trows java.lang.StackOverflowError error.
Suggest a solution.