onUtteranceCompleted 没有被调用?
即使我设置正确:
HashMap<String, String> myHashRender = new HashMap<String, String>();
myHashRender.put(TextToSpeech.Engine.KEY_PARAM_UTTERANCE_ID, "utid");
mTts.speak("Speak something", TextToSpeech.QUEUE_ADD, myHashRender);
也在
mTts.setOnUtteranceCompletedListener(this);
onInit 函数中返回成功。 onUtteranceCompleted 仍然没有被调用。虽然有重复的问题,但我找不到答案。
我的 Activity 还实现了 OnUtteranceCompletedListener。
请帮忙。
Even though I am setting it correctly:
HashMap<String, String> myHashRender = new HashMap<String, String>();
myHashRender.put(TextToSpeech.Engine.KEY_PARAM_UTTERANCE_ID, "utid");
mTts.speak("Speak something", TextToSpeech.QUEUE_ADD, myHashRender);
also
mTts.setOnUtteranceCompletedListener(this);
in the onInit function return success.
Still the onUtteranceCompleted does not get called. Though there are duplicate questions, but no where I could find the answer.
My Activity also implements OnUtteranceCompletedListener.
Please help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在tts对象的onInit函数中调用setOnUtteranceCompletedListener。
如果要在调用 onUtteranceCompleted 函数时对 UI 进行任何更改,请在 runOnUIThread 方法中添加代码。
并且请记住在调用 talk() 函数时添加 Hashmap 参数值
示例:
Call the setOnUtteranceCompletedListener inside the onInit function of the tts object.
If you want to make any changes to the UI on the call of the onUtteranceCompleted function, add the code inside a runOnUIThread method.
And do remember to add the Hashmap param value while calling the speak() function
Example :