Last active
August 22, 2019 23:46
-
-
Save Younes-Charfaoui/5680355d8d9cc58c90d25edd7e455273 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| override fun onInit(status: Int) { | |
| // check the results in status variable. | |
| if (status == TextToSpeech.SUCCESS) { | |
| // setting the language to the default phone language. | |
| val ttsLang = textToSpeech.setLanguage(Locale.getDefault()) | |
| // check if the language is supportable. | |
| if (ttsLang == TextToSpeech.LANG_MISSING_DATA || ttsLang == TextToSpeech.LANG_NOT_SUPPORTED) { | |
| Toast.makeText(this, "We can't support your language", Toast.LENGTH_LONG).show() | |
| } | |
| } else { | |
| Toast.makeText(this, "TTS Initialization failed!", Toast.LENGTH_SHORT).show() | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment