如何以编程方式更改TTS默认引擎 [英] How to Programmatically Change TTS Default Engine

查看:644
本文介绍了如何以编程方式更改TTS默认引擎的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

除了Android随附的Pico TTS引擎外,我还安装了另一个TTS引擎.我可以手动更改系统使用的默认值:

In addition to the Pico TTS engine that comes with Android, I have another TTS engine installed. I can change which is the default used by the system -- manually:

Settings > Voice input & output > Text-to-speech settings > Default Engine

我希望能够在我的应用程序中以编程方式进行此操作.这可能吗?

I would like to be able to do that programmatically, from within my application. Is this possible?

如果是这样,我将如何处理?

If so, how would I go about that?

推荐答案

您无法更改默认引擎.不过,您可以通过调用 TextToSpeech.setEngineByPackageName()(自2.2版开始可用),或使用带有引擎包参数的构造函数(在ICS中可用,因此目前还不十分有用).

You can't change the default engine. You can however, change the engine you are using by calling TextToSpeech.setEngineByPackageName() (available since 2.2) or use the constructor that takes an engine package parameter (available in ICS, so not really useful right now).

ICS之前也没有API来确定安装了哪些引擎,因此您需要事先了解其他引擎的软件包才能使用它.

There is also no API before ICS to find out what engines are installed, so you need to know the other engine's package beforehand to be able to use it.

这篇关于如何以编程方式更改TTS默认引擎的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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