我尝试JAPANESE
在我的 Android 4 设备上使用语言。
int value = tts.setLanguage(Locale.JAPANESE);
但值为-2。
这是我的检查代码
protected void check(int requestCode, int resultCode, Intent data) {
if (requestCode == 0) {
switch (resultCode) {
case TextToSpeech.Engine.CHECK_VOICE_DATA_PASS:
tts = new TextToSpeech(this, this);
break;
case TextToSpeech.Engine.CHECK_VOICE_DATA_BAD_DATA:
case TextToSpeech.Engine.CHECK_VOICE_DATA_MISSING_DATA:
case TextToSpeech.Engine.CHECK_VOICE_DATA_MISSING_VOLUME:
Intent installIntent = new Intent();
installIntent.setAction(TextToSpeech.Engine.ACTION_INSTALL_TTS_DATA);
startActivity(installIntent);
break;
case TextToSpeech.Engine.CHECK_VOICE_DATA_FAIL:
default:
Log.e(TAG, "Got a failure. TTS not available");
}
}
}
如果不存在,我想安装语言。但应用程序崩溃。这是正确的,我该怎么办?如何获得日语?