1 先定义如下EditText和TextWatcher :
2 EditText editText;
3 TextWatcher textWatcher;
4
5 (如下代码放在一个方法中)
6
7 editText.addTextChangedListener(textWatcher);
8 textWatcher = new TextWatcher() {
9
10 @Override
11 public void onTextChanged(CharSequence s, int start, int before, int count) {
12 // TODO Auto-generated method stu
14 }
15
16 @Override
17 public void beforeTextChanged(CharSequence s, int start, int count,
18 int after) {
19 // TODO Auto-generated method stub
21 }
22
23 @Override
24 public void afterTextChanged(Editable s) {
25 /**
26 * 在这个方法里面写EditText输入的监听事件
27 */
28
29 }
30 };