android editText max limit

11,103

In XML itself for EditText give the following Attrib,

  android:maxLength="20"
Share:
11,103
Buda Gavril
Author by

Buda Gavril

Updated on June 11, 2022

Comments

  • Buda Gavril
    Buda Gavril almost 2 years

    After I set the max character limit for an editText using InputFilter.LengthFilter, is there a way to make editText to react at onTextChanged after it reaches the maximum number of characters? if not, is there a simple way to set a max number of characters to an editText and still react at onTextChanged event?

  • Buda Gavril
    Buda Gavril about 13 years
    my max length is variable... it depends on some variables, so I have to set it from code.
  • Ganapathy C
    Ganapathy C about 13 years
    then try this InputFilter[] FilterArray = new InputFilter[1]; FilterArray[0] = new InputFilter.LengthFilter(variable); editEntryView.setFilters(FilterArray);
  • Buda Gavril
    Buda Gavril about 13 years
    this is what I've done, but after the maximum limit is reached, I can't canch the event when user wants to type