Code example for TextToSpeech

Methods: shutdown, getCurrentEngine

0
        // Keep track of the previous engine that was being used. So that 
        // we can reuse the previous engine. 
        // 
        // Note that if TextToSpeech#getCurrentEngine is not null, it means at 
        // the very least that we successfully bound to the engine service. 
        mPreviousEngine = mTts.getCurrentEngine();
 
        // Step 1: Shut down the existing TTS engine. 
        if (mTts != null) {
            try { 
                mTts.shutdown();
                mTts = null;
            } catch (Exception e) {
                Log.e(TAG, "Error shutting down TTS engine" + e);
            } 
        } 
 
        // Step 2: Connect to the new TTS engine. 
        // Step 3 is continued on #onUpdateEngine (below) which is called when 
        // the app binds successfully to the engine. 
Contextual code suggestions in your IDE  Get Codota for Java