Code example for TextToSpeech

Methods: setLanguagesetOnUtteranceProgressListener

0
	@Override 
	public void onInit(int status) { // TODO Auto-generated method stub
 
		if (status == TextToSpeech.SUCCESS) {
 
			int result = tts.setLanguage(Locale.US);
 
			if (result == TextToSpeech.LANG_MISSING_DATA
					|| result == TextToSpeech.LANG_NOT_SUPPORTED) {
				Log.e("TTS", "This Language is not supported");
			} 
 
		} else if (status == TextToSpeech.ERROR) {
			Log.e("TTS", "Initilization Failed!");
		} 
		Log.d(LOG_TAG, "after initialization");
		//tts.setOnUtteranceCompletedListener(this); 
		tts.setOnUtteranceProgressListener(new UtteranceProgressListener() {
			 
			@Override 
			public void onStart(String utteranceId) {
				// TODO Auto-generated method stub 
				Log.d(LOG_TAG, "in utterence onstart");
Stop searching for code, let great code find you!  Add Codota to your java IDE