Code example for TextToSpeech

Methods: shutdown, stop

0
    } 
     
    @Override 
    public void onDestroy() { 
        if (mTts != null) {
            mTts.stop();
            mTts.shutdown();
        } 
        super.onDestroy(); 
    } 
 
    public void onInit(int status) {
        if (status == TextToSpeech.SUCCESS) {
            int result = mTts.setLanguage(Locale.ENGLISH);
            if (result == TextToSpeech.LANG_MISSING_DATA || result == TextToSpeech.LANG_NOT_SUPPORTED)
            	this.onDestroy();
            mTts.setOnUtteranceCompletedListener(this);
        } 
    } 
 
	@Override