I have a drawItems() method that creates a new layout each time and sets it as a contentView . And I also have an EditText control that should delete other elements when the content changes.
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) { } });
What I want to do is save its current text, delete all the elements and leave only the EditText with the saved string . When I try to run this application, a StackOverflow error occurs because it makes the drawItems method drawItems infinite number of times. Why does it drawItems inside afterTextChanged , even if I do not change its contents? It is displayed even before the entire page loads.
source share