TextToSpeech.setEngineByPackageName()不设置任何东西 [英] TextToSpeech.setEngineByPackageName() doesn't set anything

查看:441
本文介绍了TextToSpeech.setEngineByPackageName()不设置任何东西的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个答案小费,我放置的 setEngineByPackageName 的通话权的onActivityResult(),当请求code == REQ_TTS_STATUS_CHECK&放大器;&安培; TextToSpeech.Engine.CHECK_VOICE_DATA_PASS

Following the tip in this answer, I placed a call to setEngineByPackageName right in onActivityResult(), when requestCode == REQ_TTS_STATUS_CHECK && TextToSpeech.Engine.CHECK_VOICE_DATA_PASS:

  tts = new TextToSpeech(this, this);
  tts.setEngineByPackageName("com.ivona.tts.voicebeta.eng.usa.kendra");          

但不管我是否选中了在文本到语音的设置始终使用我的设置,我总是在微微默认引擎!

是的,我故意设置微微引擎是默认的,这样我可以测试由上述提示。但是,API方法似乎没有在所有工作正常,或者......我思念的东西?

Yes, I intentionally set the pico engine to be the default, so that I can test overriding it by the aforementioned tip. But that API method seems not to be working at all, or... am I missing something?

(我知道的 setEngineByPackageName 的是德precated,因为当TTS引擎已被初始化不告知来电者,但我需要支持的API 8,所以这个方法是我的目前唯一的选择)

(I know that setEngineByPackageName is deprecated, since it doesn't inform caller when the TTS engine has been initialized, but I need to support API 8, so this method is my only option at the moment)

推荐答案

您说,你打的电话在的onActivityResult到setEngineByPackageName()。这是错误的地方要做到这一点。

You say that you placed the call to setEngineByPackageName in onActivityResult(). This is the wrong place to do this.

setEngineByPackageName,就像getDefaultEngine,不能达到之前名为的OnInit()

setEngineByPackageName, just like getDefaultEngine, must not be called before reaching onInit().

这篇关于TextToSpeech.setEngineByPackageName()不设置任何东西的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆