TextWatcher afterTextChanged causes stackoverflow in android
问题 I have a method drawItems() which everytime creates a new layout and sets it as a contentView . And I also have a control EditText which should remove other elements when it's content is changed. edit.addTextChangedListener(new TextWatcher() { public void afterTextChanged(Editable s) { currentText = s.toString(); drawItems(); } public void beforeTextChanged(CharSequence s, int start, int count, int after) { } public void onTextChanged(CharSequence s, int start, int before, int count) { } });