我正在构建一个使用语音识别的应用程序..我将最后一个句子存储在textView的一个字符串中,并尝试将它与所说的新单词进行比较,用户说,从文本视图应该被删除的字符串“删除”的最后一个字..使用语音识别从TextView中删除最后一个单词
我不知道什么是错的这个代码..提前
if(requestCode == request_code && resultCode == RESULT_OK)
{
ArrayList<String> matches = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS);
if(matches != null && matches.size() > 0)
{
text = matches.get(0);
if(text == "hello")
{
text = (String) et.getText();
rep = text.replaceAll("\\d+\\Z", "");
Log.d(tag, "THis is not working");
et.setText(rep);
rep = null;
}
else
{
option = matches.get(0);
et.setText(option);
}
}
感谢:d
如何进行代码的行为,现在,有没有异常?或者它没有找到任何匹配?请让我们知道发生了什么 – Jimmy 2012-03-05 20:19:16
先生我想删除最后一个字,当用户说“你好”,像一个退格.. – Shah 2012-03-05 20:42:59