I’ve been working on an Android app lately that uses the Text to Speech functionality and I wanted to have a spinner that can display all available languages on an Android device. Now I’m going to show you how to get a list of supported languages in this short Android tutorial.

Option #1: RecognizerIntent

One way to do it is via broadcasting a RecognizerIntent.ACTION_GET_LANGUAGE_DETAILS¬†intent. See example here. Unfortunately, this didn’t work for me as the result Intent didn’t contain value for the¬†RecognizerIntent.EXTRA_SUPPORTED_LANGUAGES key.

Option #2: isLanguageAvailable() method

This is the option that did the trick for me. Nothing fancy, I used the isLanguageAvailable() method of the TextToSpeech class:

TextToSpeech tts = ...
// let's assume tts is already inited at this point:
Locale[] locales = Locale.getAvailableLocales();
List<Locale> localeList = new ArrayList<Locale>();
for (Locale locale : locales) {
    int res = tts.isLanguageAvailable(locale);
    if (res == TextToSpeech.LANG_COUNTRY_AVAILABLE) {
// at this point the localeList object will contain
// all available languages for Text to Speech

For more details on how to initialize the Android TTS engine, you’ll find a tutorial¬†here.

  • Teddy Iris

    But if the user has mutiple languages avalable for speech typing how do I know in my application which one he used to speak? Thanks.

    • David Kiss

      The easiest may be to offer users a dropdown box to choose the language they may want to use.

      • Teddy Iris

        yes, this might be a way only if setting language extra to intent forces the user to use that language no matter what. From what I know, the google speech input popup prompt by intent, if the user has more speech input languages selected he can still choose another one from the drop down so in this case the result is different from the language I selected in application.

        I will try and get back with a reply. Thanks.

  • Carlos

    The option 2 adds only the languages supported by the tts engine but no the current availables and installed in your device