Code example for TextToSpeech

Methods: isLanguageAvailablesetLanguagesetSpeechRate

0
 
    @Override 
    public void onInit(int status) {
        if(status == TextToSpeech.SUCCESS) {
            Locale locale = Locale.US;
            if(this.textToSpeech.isLanguageAvailable(locale) >= TextToSpeech.LANG_AVAILABLE) {
                this.textToSpeech.setLanguage(locale);
                this.textToSpeech.setSpeechRate( (float) 0.8);
            } 
            else { 
                Log.e("TTS", "Not support locale.");
            } 
        } 
        else { 
            Log.e("TTS", "Init error.");
        }  
    } 
     
    public void renderReuslt( String userInput ){
        View resultContainer = (View)findViewById( R.id.PronounceResultContainer); 
Experience pair programming with AI  Get Codota for Java