You can use InputFilter to change it to regular expressions so that only Korean is input.
// So that only Korean is entered
public InputFilter filterAlphaNum = new InputFilter() {
public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) {
Patterns = Pattern.compile ("^[-가--he]*$");
if (!ps.matcher(source).matches()) {
return "";
}
return null;
}
};
// Apply to EditText as follows.
editText.setFilters(new InputFilter[]{filterAlphaNum});
//You only need to change the regular expression from the source below.
Pattern ps = Pattern.compile("^[a-zA-Z0-9]*$");
To enter only Korean: "[-가-hehe]*$" For English only: "[a-zA-Z]*$" Only numbers are entered: "[0-9]*$"
[-가--he]*$"[a-zA-Z]*$"[0-9]*$"If you want only English and numeric characters to be entered, you can enter "[a-zA-Z0-9]*$".
[a-zA-Z0-9]*$"
© 2024 OneMinuteCode. All rights reserved.