I want to use Input filter where I can prevent first space entering AND max length of my edit text limited to 200 characters.
so far I have this: Hot to I put the maxlength into the same filter
private void setInputFilterForEmailAndPwd(final EditText amountEditText) {
InputFilter filter = new InputFilter() {
public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) {
for (int i = start; i < end; i++) {
if (Character.isSpace(source.charAt(i))) {
return "";
}
}
return null;
}
};
amountEditText.setFilters(new InputFilter[] { filter });
}
setInputFilterForEmailAndPwd(emailEdit);