Android EditText Max Length [duplicate]

Solution 1:

Possible duplicate of Limit text length of EditText in Android

Use android:maxLength="140"

That should work. :)

Hope that helps

Solution 2:

I had the same problem.

Here is a workaround

android:inputType="textNoSuggestions|textVisiblePassword"
android:maxLength="6"

Thx to How can I turnoff suggestions in EditText?

Solution 3:

EditText editText= ....;
InputFilter[] fa= new InputFilter[1];
fa[0] = new InputFilter.LengthFilter(8);
editText.setFilters(fa);

Solution 4:

I had the same problem. It works perfectly fine when you add this:

android:inputType="textFilter"

to your EditText.