Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/search/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用非英语字符?Android,onSearchRequested()_Android_Search_Non English - Fatal编程技术网

如何使用非英语字符?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?