Make your edittext reject emojis input
Here's the source code - ONCREATE of activity
EditText editText = findViewById(R.id.editText);
editText.setFilters(new InputFilter[] { new 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) { Toast.makeText(getApplicationContext(), "Emojis are not allowed", Toast.LENGTH_SHORT).show(); return ""; } } return null; } } });
©2024 Sketchub | User Policy