隐藏Google 语音识别
Hide Google Voice recognition
我正在使用 Google 语音识别,并希望使用 Google 和显示的麦克风隐藏弹出窗口。这是我的代码:
Intent intent = new Intent(
RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, getResources().getString(R.string.ttslang));
try {
startActivityForResult(intent, RESULT_SPEECH);
} catch (ActivityNotFoundException a) {
Toast t = Toast.makeText(getApplicationContext(),
getResources().getString(R.string.notts),
Toast.LENGTH_SHORT);
t.show();
}
因为我认为我已经看到了这样的应用程序,所以我认为这是可能的..如果是的话,有人知道怎么做吗?
非常感谢!
为此,您需要使用 SpeechRecognizer. An example can be found here。
实施起来很容易:
SpeechRecognizer recognizer = SpeechRecognizer.createSpeechRecognizer(this);
recognizer.setRecognitionListener(new RecognitionListener() { ... });
侦听器捕获事件并相应地处理它们。
我正在使用 Google 语音识别,并希望使用 Google 和显示的麦克风隐藏弹出窗口。这是我的代码:
Intent intent = new Intent(
RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, getResources().getString(R.string.ttslang));
try {
startActivityForResult(intent, RESULT_SPEECH);
} catch (ActivityNotFoundException a) {
Toast t = Toast.makeText(getApplicationContext(),
getResources().getString(R.string.notts),
Toast.LENGTH_SHORT);
t.show();
}
因为我认为我已经看到了这样的应用程序,所以我认为这是可能的..如果是的话,有人知道怎么做吗?
非常感谢!
为此,您需要使用 SpeechRecognizer. An example can be found here。
实施起来很容易:
SpeechRecognizer recognizer = SpeechRecognizer.createSpeechRecognizer(this);
recognizer.setRecognitionListener(new RecognitionListener() { ... });
侦听器捕获事件并相应地处理它们。