On some Galaxy S6, Android 6.0 it results in a
java.lang.IllegalArgumentException: Invalid int: "OS"
This is almost certainly an Android bug, but show
a message instead of crashing.
<string name="nextWord">Next word</string>
<string name="previousWord">Previous word</string>
<string name="randomWord">Random word</string>
<string name="nextWord">Next word</string>
<string name="previousWord">Previous word</string>
<string name="randomWord">Random word</string>
+ <string name="TTSbroken">TTS is broken on this device</string>
<!-- About dictionary. -->
<string name="dictionaryPath">File: %s</string>
<!-- About dictionary. -->
<string name="dictionaryPath">File: %s</string>
}
final Locale locale = new Locale(dictionary.indices.get(i).sortLanguage.getIsoCode());
Log.d(LOG, "Setting TTS locale to: " + locale);
}
final Locale locale = new Locale(dictionary.indices.get(i).sortLanguage.getIsoCode());
Log.d(LOG, "Setting TTS locale to: " + locale);
final int ttsResult = textToSpeech.setLanguage(locale);
if (ttsResult != TextToSpeech.LANG_AVAILABLE &&
ttsResult != TextToSpeech.LANG_COUNTRY_AVAILABLE) {
Log.e(LOG, "TTS not available in this language: ttsResult=" + ttsResult);
}
final int ttsResult = textToSpeech.setLanguage(locale);
if (ttsResult != TextToSpeech.LANG_AVAILABLE &&
ttsResult != TextToSpeech.LANG_COUNTRY_AVAILABLE) {
Log.e(LOG, "TTS not available in this language: ttsResult=" + ttsResult);
}
+ } catch (Exception e) {
+ Toast.makeText(this, getString(R.string.TTSbroken), Toast.LENGTH_LONG).show();
+ }
}
void onLanguageButtonClick() {
}
void onLanguageButtonClick() {