textwatcher的事件被调用两次 [英] Events of textwatcher are called twice
本文介绍了textwatcher的事件被调用两次的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我我的申请,我把textWatcher上的EditText。当我改变的EditText textwatcher的事件称为两次的文本。我使用的模拟器上运行的应用程序。
I my application i put textWatcher on edittext. When i change the text of edittext the events of textwatcher is called twice. I am using emulator for running the app.
推荐答案
请问你的code样子?即TextWatcher的正常行为。 例如:
How does your code looks like? that is the normal behaviour of TextWatcher. Example:
myInput.addTextChangedListener(new TextWatcher() {
boolean mToggle = false;
public void onTextChanged(CharSequence cs, int s, int b, int c) {
}
public void afterTextChanged(Editable editable) {
if (mToggle)
Toast.makeText(getBaseContext(), "HIT KEY", Toast.LENGTH_LONG).show();
mToggle = !mToggle;
}
public void beforeTextChanged(CharSequence cs, int i, int j, int k) {
}
});
这篇关于textwatcher的事件被调用两次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文