Code example for TextToSpeech

    public void initTTS() { 
        // Initialize text-to-speech. This is an asynchronous operation. 
        // The OnInitListener (second argument) is called after initialization completes. 
        Log.i(TAG, "Initializing TextToSpeech...");
        mTts = new TextToSpeech(mService,
            this  // TextToSpeech.OnInitListener
    public void shutdownTTS() { 
        Log.i(TAG, "Shutting Down TextToSpeech...");
        mSpeakingEngineAvailable = false;
        Log.i(TAG, "TextToSpeech Shut Down.");
    public void say(String text) {
        if (mSpeak && mSpeakingEngineAvailable) {
                    TextToSpeech.QUEUE_ADD,  // Drop all pending entries in the playback queue.
Contextual code suggestions in your IDE  Get Codota for Java