check API
This commit is contained in:
parent
fd7d2819b8
commit
fa7639189f
1 changed files with 7 additions and 4 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue