Code example for TextToSpeech

Methods: speak

0
        speechHandler.postDelayed(new Runnable() {
            public void run() { 
                try { 
                    if (!isShutdown.get()) {
                        if (ttsLatch.await(10, TimeUnit.MILLISECONDS)) {
                            tts.speak(speech, TextToSpeech.QUEUE_FLUSH, null);
                        } else { 
                            sayLater(speech, 100L);
                        } 
                    } 
                } catch (InterruptedException e) {
                    // restore interrupt 
                    Thread.currentThread().interrupt();
                } 
            } 
        }, delay);
    } 
 
    /** 
     * If the TTS has initialised successfully, says what needs to be said. 
     *