0

How to get MaxLength of Edittext in Android ?

It's already set by:

android:maxLength="6

OR

editText.setFilters(new InputFilter[] { new InputFilter.LengthFilter(12) });
jub0bs
  • 60,866
  • 25
  • 183
  • 186
procoder
  • 1
  • 1
  • I would get the filters list, test if one of these is an instance of InputFilter.LengthFilter, then cast it, and `getMax` on it. – njzk2 Dec 29 '14 at 19:40

1 Answers1

1

the function getMax is added in API level 21, for older version use this How to Get EditText maxLength setting in code

Community
  • 1
  • 1
Gally
  • 73
  • 5