I’d like to add a delay between the text to speech and the subsequent voice recognition but don’t know enough about wait/sleep statements and the concept of not blocking the main thread. Could I have suggestions on how to achieve a wait until the text to speech is finished speaking and the voice recognition starting.
String myText1 = "Please speak the new speedlimit";
mTts.speak(myText1, TextToSpeech.QUEUE_FLUSH, null);
speechSucess = true;
startVoiceRecognitionActivity();
Set an
OnUtteranceCompletedListenerand callstartVoiceRecognitionActivity();from the listener’s callback function:http://developer.android.com/reference/android/speech/tts/TextToSpeech.html#setOnUtteranceCompletedListener(android.speech.tts.TextToSpeech.OnUtteranceCompletedListener)