Pergunta

In one of my apps, I need to determine the default language that's set for the default TTS engine.

Setting this "TTS engine's default language" is usually set by the user, touching the settings icon on the right-hand side of the TTS engine (e.g. SVOX Classic TTS, Google Text-to-speech, etc.), then selecting Language)

Unfortunately, the ability to get this information directly was only introduced in API 18, via TextToSpeech.getDefaultLanguage().

Is there a way (albeit longer) to achieve the same in API 8 (Android 2.2)?

Note: I did try calling TextToSpeech.getLanguage() but all it returns is the currently used language, not necessarily the default set one.

Foi útil?

Solução

If in onInit(int status) you call getLanguage() before calling setLanguage(Locale loc) you will get the default set by the user. I tested in my phone setting Italian to be the default using the system settings and when call getLanguage the locale return is Italian. When I change it to German again I got the return locale to be Deutch.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top