Code example for TextToSpeech

Methods: speak, synthesizeToFile

0
		mp.start();
		} else { 
			//Save talker to wav, update uri 
			String filename = DPfinal.getActivity().getExternalFilesDir("wavs").toString();
			filename = filename + "/" + currentWord + ".wav" ;
			if (0==talker.synthesizeToFile(currentWord, null, filename))
				DPfinal.getDBHandler().updateUri(currentWord, filename);
			talker.speak(currentWord, TextToSpeech.QUEUE_FLUSH, null);
		} 
	} 
 
	@Override 
	public void onInit(int status) {
		if (status == TextToSpeech.SUCCESS) {
			int result = talker.setLanguage(Locale.US);
	        if (result == TextToSpeech.LANG_MISSING_DATA
	                    || result == TextToSpeech.LANG_NOT_SUPPORTED) {
	        	Log.e("TTS", "This Language is not supported");
	        }  
	  
	    } else {