

The queue mode parameter can be QUEUE_ADD to add the new entry at the end of the playback queue or QUEUE_FLUSH to overwrite the entries in the playback queue with the new entry. The first parameter of the speak() method is the text to be spoken and the second parameter is the queue mode. Once the TextToSpeech engine initialization is complete, we can call the speak() method of the TextToSpeech class to play the text as speech.

The onInit() method has an integer parameter which represents the status of TextToSpeech engine initialization. The TextToSpeech.OnInitListener contains the onInit() method which is called when the TextToSpeech engine initialization is complete. To convert text to speech in any app, an instance of the TextToSpeech class and the TextToSpeech.OnInitListener interface are required.

Android SDK text to speech engine is a very useful tool to integrate voice in your Android apps.
