Alex Rivera | Logout

How do you set the max number of characters for an EditText in Android?

Asked 2011-05-20T00:10:52.920
141

How do you set the max number of characters for an Android EditText input? I see setMaxLines, setMaxEMS, but nothing for the number of characters.

Edit
Report

1 Answer

274

In XML you can add this line to the EditText View where 140 is the maximum number of characters:

android:maxLength="140"
answered 2011-08-02T14:30:58.950

Your Answer