Reputation: 833
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();
Upvotes: 0
Views: 1198
Reputation: 9591
Set an OnUtteranceCompletedListener
and call startVoiceRecognitionActivity();
from the listener's callback function:
Upvotes: 4