Code example for TextToSpeech

Methods: speak

0
 
    private void sayHello() { 
        // Select a random hello. 
        int helloLength = HELLOS.length;
        String hello = HELLOS[RANDOM.nextInt(helloLength)];
        mTts.speak(hello,
            TextToSpeech.QUEUE_FLUSH,  // Drop all pending entries in the playback queue.
            null); 
    } 
 
}