0
softkeyboard我可以選擇語音到文本,當我說話時顯示一個建議列表,當我選擇一個文本時,我需要用這個文本填寫我的editText,我該怎麼做到這一點我有看到SpeechRecognizer類,我不知道我可以利用這一點,請大家幫我安卓語音文本處理
SpeechRecognizer rec=SpeechRecognizer.createSpeechRecognizer(context);
RecognitionListener listener = new RecognitionListener() {
@Override
public void onRmsChanged(float rmsdB) {
}
@Override
public void onResults(Bundle results) {
ArrayList<String> voiceResults = results.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION);
}
@Override
public void onReadyForSpeech(Bundle params) {
// TODO Auto-generated method stub
}
@Override
public void onPartialResults(Bundle partialResults) {
}
@Override
public void onEvent(int eventType, Bundle params) {
}
@Override
public void onError(int error) {
}
@Override
public void onEndOfSpeech() {
}
@Override
public void onBufferReceived(byte[] buffer) {
}
@Override
public void onBeginningOfSpeech() {
}
};
rec.setRecognitionListener(listener);