As you observed, there is no direct method to limit the number of characters that can be typed in am EditText.
However, there is a solution using InputFilter. Follow the below script and you can set up maximum numbers of characters you allow to be entered in an EditText.
int maxLength = 50; InputFilter FilterArray = new InputFilter; FilterArray = new InputFilter.LengthFilter(maxLength); editText.setFilters(FilterArray);
To use InputFilter, you must import android.text.InputFilter;