Code example for TextToSpeech

Methods: shutdown

0
 
    @Override 
    public void onDestroy() { 
        super.onDestroy(); 
        if (mTts != null) {
            mTts.shutdown();
            mTts = null;
        } 
    } 
 
    private void initSettings() { 
        final ContentResolver resolver = getContentResolver();
 
        // Set up the default rate. 
        try { 
            mDefaultRate = Settings.Secure.getInt(resolver, TTS_DEFAULT_RATE);
        } catch (SettingNotFoundException e) {
            // Default rate setting not found, initialize it 
            mDefaultRate = TextToSpeech.Engine.DEFAULT_RATE;
        } 
        mDefaultRatePref.setValue(String.valueOf(mDefaultRate));