In my app, I call TextToSpeech.getLanguage() well after instantiating TextToSpeech (~800ms according to LogCat), yet it sometimes (not always) return null, despite the language set properly in the system's TextToSpeech settings:
System Settings > Language & input >
Text-to-speech output > Google Text-to-speech > English (United Kingdom)
This only happens in Jelly Bean (Android 4.1.1). It doesn't happen in Android 2.2.
Is this a known Android bug? Or am I doing something wrong?
I instantiate, BTW, TextToSpeech in my app's main activity with:
new TextToSpeech(this, this);
And both instantiation and the call to TextToSpeech.getLanguage() are made in the same thread (thus order of calls is guaranteed).