Android – What’s the best way to limit text length of EditText in Android

androidandroid-edittextmaxlength

What's the best way to limit the text length of an EditText in Android?

Is there a way to do this via xml?

Best Answer

Documentation

Example

android:maxLength="10"