Android TTS 中缺少语言
我正在开发一个使用谷歌提供的 TextToSpeech 功能的 Android 应用程序,并遵循以下示例:
我想通过这一行了解:
int result = mTts.setLanguage(Locale.US);
if (result == TextToSpeech.LANG_MISSING_DATA ||
result == TextToSpeech.LANG_NOT_SUPPORTED) {
// Lanuage data is missing or the language is not supported.
}
如果用户设备上的语言数据丢失,我该怎么办?如果数据不存在,应用程序将无法继续?有没有办法让用户在他们的设备上获取语言?我有一个测试设备,似乎根本没有任何语言。
I am working on an android application that uses the TextToSpeech functionality provided by google and have followed this example:
I want to know with this line:
int result = mTts.setLanguage(Locale.US);
if (result == TextToSpeech.LANG_MISSING_DATA ||
result == TextToSpeech.LANG_NOT_SUPPORTED) {
// Lanuage data is missing or the language is not supported.
}
What can I do if the Language data is missing off the users device? The app will not continue if the data is not there? Is there a way to allow the user to get the language on their device? I have a test device that seems to not have any languages on it at all.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
来自 http://developer.android.com/resources/articles/tts.html:
没有好方法来确切地知道如果他们想要的语言根本不存在会发生什么,但是......这是处理它的推荐方法。
From http://developer.android.com/resources/articles/tts.html:
No good way to know exactly what happens if the language they want simply doesn't exist at all, but....that is the recommended way of dealing with it.