我使用AddTextChangedListener
编辑了文字:
edit_text.AddTextChangedListener(new NumberTextWatcher());
现在我要删除TextChangedListener for the
EditText`。
我尝试过使用下面的代码,但我没有运气。
edit_text.RemoveTextChangedListener(NumberTextWatcher);
答案 0 :(得分:1)
您需要将引用存储到某个地方NumberTextWatcher
以便稍后将其删除
//Field that stores the reference
private readonly NumberTextWatcher watcher = new NumberTextWatcher();
//Adds the listener
edit_text.AddTextChangedListener(watcher);
//Later in your code you can simply remove it like this:
edit_text.RemoveTextChangedListener(watcher);