Code example for TextToSpeech

Methods: shutdown, stop

0
        }               
    } 
    public void onDestroy() { 
        // Don't forget to shutdown! 
        if (mTts != null) {
            mTts.stop();
            mTts.shutdown();
        } 
        super.onDestroy(); 
    } 
    public void onInit(int status) {
        if (status == TextToSpeech.SUCCESS) {
            int result = mTts.setLanguage(Locale.US);
            if (result == TextToSpeech.LANG_MISSING_DATA ||
                result == TextToSpeech.LANG_NOT_SUPPORTED) {
                Log.e(TAG, "Language is not available.");
            } else { 
    			//mTts.speak("No success."); 
            } 
        } else { 
            Log.e(TAG, "Could not initialize TextToSpeech.");