如何使用非英语字符?Android,onSearchRequested()
如何使用非英语字符?Android,onSearchRequested(),android,search,non-english,Android,Search,Non English,onSearchRequested()函数只接受英文字符。例如,当我在搜索框中输入ş字符时,它不会显示任何内容 如何将非英语字符定义到searchrequest中?使用模式和匹配器。。那会更好 看到这一点,你可以改变模式,根据你。。。使用类似于[a-zA-Z0-9] 试试这个 EditText state = (EditText) findViewById(R.id.txtState); Pattern ps = Pattern.compile("^[a-zA
onSearchRequested()
函数只接受英文字符。例如,当我在搜索框中输入ş字符时,它不会显示任何内容
如何将非英语字符定义到searchrequest中?使用模式和匹配器。。那会更好 看到这一点,你可以改变模式,根据你。。。使用类似于
[a-zA-Z0-9]
试试这个
EditText state = (EditText) findViewById(R.id.txtState);
Pattern ps = Pattern.compile("^[a-zA-Z ]+$");
Matcher ms = ps.matcher(state.getText().toString());
boolean bs = ms.matches();
if (bs == false) {
if (ErrorMessage.contains("invalid"))
ErrorMessage = ErrorMessage + "state,";
else
ErrorMessage = ErrorMessage + "invalid state,";
}
我想使用onSearchRequest(),因为它推荐结果。如何将非英语字符定义为onSearchRequest?