Egor Egor - 1 year ago 192
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.

Answer Source

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)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download