I made an app in Andoid Studio with Java, that will listen to speech, recognize it, turn speech to text, and when I allow it to it will respond back with text to speech.
In the beginning I got a lot of self-repeating, because it listened to itself, spoke back, listenede to itself, spoke back, and so on. So far I have limited this behavior with this code:
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
public void run() {
startlytting();
}
}, 1000);
It still happens somethimes, probably because some response speeches are longer than 1000ms. Is there a way I could know when the text-to-speech is done speaking, and then turn on the speech listener?