Android java tts.isLanguageAvailable() not working even after language is available

I want to check if a specific language pack (Google Text-to-Speech) is available or not.

t1=new TextToSpeech(getApplicationContext(), new TextToSpeech.OnInitListener() {
            @Override
            public void onInit(int status) {
               if(t1.isLanguageAvailable(new Locale("bn_BD")) >= TextToSpeech.LANG_AVAILABLE)
               {
                // Set language
               }
            }
        });

but the problem is t1.isLanguageAvailable(new Locale("bn_BD")) is always returing false even the language is available and also working this voice.

Upvotes: 2

Views: 553

Answers (1)

Nerdy Bunz
Nerdy Bunz

Reputation: 7437

You must construct the Locale object using separate strings for the language and country like this:

new Locale("bn", "BD")

see this and this. :)

Upvotes: 1

Related Questions