// 영문 + 숫자 public InputFilter filterAlphaNum = new InputFilter() { public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { Pattern ps = Pattern.compile("^[a-zA-Z0-9]*$"); if (!ps.matcher(source).matches()) { return ""; } return null; } }; // 한글 public InputFilter filterKor = new InputFilter() { public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { Pattern ps = Pattern.compile("^[ㄱ-ㅣ가-힣]*$"); if (!ps.matcher(source).matches()) { return ""; } return null; } }; editText.setFilters(new InputFilter[]{filterAlphaNum});
Jun 7, 2012
edittext 특수문자 제한, 한글만 입력
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment