Unable to detect completion of TTS (callback) android. -


I am developing an Android application in which I am using text for speech conversion. Speech conversion After this, I want to do something. My code looks like

  Implementation of the main activity activity of the public class Onin Listener, On-Outs Completed Listener {Private Static Ent REQ_CODE = 1; Private textoospech TTS = null; Private boolean ttsIsInit = false; Override public null on @reate (bundle saved instainstate) {super.naught (savedinstenstate); StartTextToSpeech (); } Private Zero startTextToSpeech () {intent intention = new intent (engine. Action_CHECK_TTS_DATA); StartActivityForResult (intent, REQ_CODE); } Safe wired onactive result (int code code, int code code, intent data) {if (requestcode == REC_code) {if (resultcode == engine CHECK_VOICE_DATA_PASS) {TTS = new textTouch (this, it); } And {intent installVoice = new intent (engine.action_INSTALL_TTS_DATA); StartActivity (installVoice); }}} Int (int status) on public null {if (status == TextToSpeech.SUCCESS) {ttsIsInit = true; Int results = tts.setOnUtteranceCompletedListener (this); If (tts.isLanguageAvailable (locale .ENGLISH)> = 0) TTSAT language (locale. NGLIISH); Tts.setPitch (5.0f); Tts.setSpeechRate (1.0f); Hashmap & lt; String, string & gt; MyHashAlarm = New Hashmap & lt; String, string & gt; (); MyHashAlarm.put (TextToSpeech.Engine.KEY_PARAM_STREAM, String.valueOf (AudioManager.REREAM_ALARM)); MyHashAlarm.put (TextToSpeech.Engine.KEY_PARAM_UTTERANCE_ID, "Some Messages"); Tts.speak ("Hello How are you?", TextSpitch, QUEUE_FLUSH, Myahashalarm); }} @ Override Public Watch OnDestoy () {if (tts! = Null) {tts.stop (); Tts.shutdown (); } Super.onDestroy (); } @ Override Public Empty On Eternity Completed (String UTIID) {Toast. Make Text (Mainly this, "done", Toast. LNNHT_LOG). Show (); If (uttId.equalsIgnoreCase ("done")) {Toast. Make text (predominantly, "inside", toast.LnnHH_LOG). Show (); }}}   

When I open my application text to work fine But how will it know whether the text of the speech has been fulfilled or not? Need help ..... Thank you .....

If you use API level 15 Or later versions, you can set progress listener on your TextToSpeech context

  setOnUtteranceProgressListener (mutation progressive listener)   

You will need to report the progress of callback TTS, which will also include callback. See and

However, I have noticed that you are already using the deprecated OnUtteranceCompletedListener . Are you receiving a callback on onUtteranceCompleted () ? It should also work.

Comments