you can use a TextWatcher to see when the text has changed
private TextView mTextView;
private EditText mEditText;
private final TextWatcher mTextEditorWatcher = new TextWatcher() {
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
public void onTextChanged(CharSequence s, int start, int before, int count) {
//This sets a textview to the current length
mTextView.setText(String.valueOf(s.length()));
}
public void afterTextChanged(Editable s) {
}
};
you set the TextWatcher for the edittext with
mEditText.addTextChangedListener(mTextEditorWatcher);
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…