Code example for TextToSpeech

0
 
        return false; 
    } 
 
    private void initTTS() { 
        mTts = new TextToSpeech(context, (OnInitListener)this);
    } 
 
    public void queueSpeak(String textToSpeak) {
        if (mTts != null && isTTSInitialized) {
            mTts.speak(textToSpeak, TextToSpeech.QUEUE_ADD, ttsParams);
            while (mTts.isSpeaking()) {
                try { 
                    Thread.sleep(50);
                } catch (InterruptedException e) {
                    // TODO Auto-generated catch block 
                    e.printStackTrace();
                } 
            } 
        } else { 
Stop searching for code, let great code find you!  Add Codota to your java IDE