TIP: How to limit the number of characters the user can enter in an EditText widget.
Given:
private EditText editTextPassword= (EditText)findViewById(R.id.EditTextPassword);
private int lengthPassword= 8;
You can limit the number of characters the user can input by applying an input filter:
// limit input length of password in editText
InputFilter[] filter = new InputFilter[1];
filter[0] = new InputFilter.LengthFilter(lengthPassword);
editTextPassword.setFilters(filter);