多个EditText实现TextWatcher接口

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    EditText e = new EditText(this);
    e.addTextChangedListener(new CustomTextWatcher(e));
}

private class CustomTextWatcher implements TextWatcher {
    private EditText mEditText;

    public CustomTextWatcher(EditText e) {
        mEditText = e;
    }

    public void beforeTextChanged(CharSequence s, int start, int count, int after) {
	
    }

    public void onTextChanged(CharSequence s, int start, int before, int count) {
	
    }

    public void afterTextChanged(Editable s) {
	
    }
}

 

你可能感兴趣的:(java,android,EditText,TextWatcher)