jax
jax

Reputation: 38623

Text to Speech setLanguage() does not work

I am using Text to Speech.

When I set the language using

mTts = new TextToSpeech(this, this);
mTts.setLanguage(Locale.UK)

I always get an American accent.

The only way to fix this is by changing the default language setting in the Android system. What am I doing wrong?

Upvotes: 7

Views: 2043

Answers (2)

Hossein Shahdoost
Hossein Shahdoost

Reputation: 1742

There is another case which the language is not installed on tts and the device doesn't have access to net I have seen it on KitKat. In that case tts doesn't change the language, It won't give getAvailableLanguages() and works only on the default language. You can see that by calling getLanguage() after you assigned the new language

Upvotes: 0

jax
jax

Reputation: 38623

SOLVED

Instead of putting it inside onActivityResult() put it inside onInit(int status) and it works

Upvotes: 10

Related Questions