check API

This commit is contained in:
sonora 2016-12-20 14:14:11 +01:00
parent fd7d2819b8
commit fa7639189f

View file

@ -166,10 +166,13 @@ public class TTSCommandPlayerImpl extends AbstractPrologCommandPlayer {
ttsRequests = 0; ttsRequests = 0;
final float speechRate = cSpeechRate; final float speechRate = cSpeechRate;
//#3344: Try Locale builder instead of constructor //#3344: Try Locale builder instead of constructor (only available from API 21)
//final Locale newLocale = new Locale(language); if (android.os.Build.VERSION.SDK_INT >= 21) {
final String[] languageFields = language.split("\\_"); final String[] languageFields = language.split("\\_");
final Locale newLocale = new Locale.Builder().setLanguage("languageFields[0]").setScript("").setRegion("languageFields[1]").build(); final Locale newLocale = new Locale.Builder().setLanguage("languageFields[0]").setScript("").setRegion("languageFields[1]").build();
} else {
final Locale newLocale = new Locale(language);
}
mTts = new TextToSpeech(ctx, new OnInitListener() { mTts = new TextToSpeech(ctx, new OnInitListener() {
@Override @Override