Egor Egor - 3 months ago 29
Android Question

EditText maximum characters limit exceeded callback

My idea is to set an error

to the
when the maximum character limit has been reached. Is there any callback about this event, or may be there's another way to achieve this effect? Thanks in advance.


You can use the edit text's setError:

editText.addTextChangedListener(new TextWatcher() {         
        public void onTextChanged(CharSequence s, int start, int before, int count) {

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

        public void afterTextChanged(Editable s) {
            if(s.length() > max)