IllegalArgumentException: Invalid int: “OS” with Samsung tts

前端 未结 2 1597
野趣味
野趣味 2020-12-10 10:42

I\'m using Text to speech in my android application.It is working Fine with Google TTs and espeak, But when i used with Samsung TTS it gives following Exception.

         


        
2条回答
  •  孤街浪徒
    2020-12-10 11:21

    I used this to avoid raising the exception.

        int result = mTts.isLanguageAvailable(Locale.US);
        if(result >= 0)
            result = mTts.setLanguage(Locale.US);
        else {
            Locale def = Locale.getDefault();
            result = mTts.isLanguageAvailable(def);
            if(result >=0 )
                result = mTts.setLanguage(def);
        }
    

提交回复
热议问题