我正试图通过谷歌TTS语音合成器朗读印地语文本,它在我的设备中工作正常,因为我已经手动安装了印地语语音数据,但是当在另一台设备上测试时,它不包含印地语语音,它不是显示下载特定语音数据的提示 . 这是部分代码:
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
if (requestCode == ACT_CHECK_TTS_DATA) {
if (resultCode == TextToSpeech.Engine.CHECK_VOICE_DATA_PASS) {
// Data exists, so we instantiate the TTS engine
textToSpeech = new TextToSpeech(this, this);
} else {
// Data is missing, so we start the TTS
// installation process
Intent installIntent = new Intent();
installIntent.setAction(TextToSpeech.Engine.ACTION_INSTALL_TTS_DATA);
startActivity(installIntent);
}
}
}
所以, TextToSpeech.Engine.ACTION_INSTALL_TTS_DATA
似乎不起作用,但我不确切知道它的作用,其余的代码很好,我相信 . 我问题的任何解决方案?
1 回答
使用以下方法检查安装或不安装的avialble语言 .