The solution is use a TextWatcher object that will receive event when the text in the EditText changes:
// Watcher to chage char counter when sms text changes
TextWatcher textWatcher = new TextWatcher() {
@Override
public void onTextChanged ( CharSequence arg0, int arg1, int arg2, int arg3 ) {
}
@Override public void beforeTextChanged ( CharSequence arg0, int arg1, int arg2, int arg3 ) {
}
@Override
public void afterTextChanged ( Editable arg0 ) {
updateCharCounter(); }
};
m_smsTextField.addTextChangedListener(textWatcher);
Nessun commento:
Posta un commento