Well, if you need to stop the user from entering a text longer than x
, simply put android:maxLength="x"
as an attribute for your EditText.
Or,
mEditText.setFilters( new InputFilter[]
{
new InputFilter.LengthFilter(<length>)
} );