I want to hide emojis and auto suggestions from keyboard programmatically. Its working in some Android devices but not in all devices. here's my code for hide auto suggestions:
txtSingupemail.setInputType(InputType.TYPE_TEXT_VARIATION_FILTER | InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS
|InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
txtSignuppwd.setInputType(InputType.TYPE_TEXT_VARIATION_FILTER | InputType.TYPE_TEXT_VARIATION_PASSWORD);
txtSignuppwd.setTransformationMethod(PasswordTransformationMethod.getInstance());
Here's the snapshot of my UI:
This is layout when user clicks signIn button. When user tap on bottom left icon which is marked red, the keyboard height goes increase due to emojis as suggestions.
See below snapshot:
Is there any way to hide those top emojis from keyboard programmatically?
Try this it's works for me
editText.setFilters(new InputFilter[]{new EmojiExcludeFilter()});
private class EmojiExcludeFilter implements InputFilter {
@Override
public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) {
for (int i = start; i < end; i++) {
int type = Character.getType(source.charAt(i));
if (type == Character.SURROGATE || type == Character.OTHER_SYMBOL) {
return "";
}
}
return null;
}
}