0
我想在EditText上添加一些TextWatchers,但我應該在需要時刪除它們。從EditText刪除所有TextWatchers
...
@BindView(R.id.widget_search_edittext)
MaterialEditText mEditText;
private List<TextWatcher> textWatcherList;
...
public void addTextChangedListener(TextWatcher watcher) {
textWatcherList.add(watcher);
mEditText.addTextChangedListener(watcher);
}
public void removeAllTextChangedListeners() {
for (TextWatcher watcher : textWatcherList) {
mEditText.removeTextChangedListener(watcher);
}
textWatcherList.clear();
}
但這並沒有工作,任何ideias?
當我嘗試刪除觀察者的等於它從來不叫 –
發佈您的代碼,請 –
我只是tryied把一個破發點在那裏進行測試。但調試器永遠無法達到它。 @Override public boolean equals(Object obj){if(obj instanceof MyMaskWatcher){ return true; } else { return false; } } –