Code example for TextToSpeech

Methods: synthesizeToFile

0
 
			@Override 
			public void onClick(View v) {
 
				// ½«EditTextÀïµÄÄÚÈݱ£´æΪÓïÒôÎļþ 
				int r = mTextToSpeech.synthesizeToFile(mEditText.getText()
						.toString(), null, "/mnt/sdcard/speak.wav");
				if (r == TextToSpeech.SUCCESS)
					displayToast("±£´æ³É¹¦£¡"); 
			} 
		}); 
		// EditTextÄÚÈݱ仯¼àÌý 
		mEditText.addTextChangedListener(mTextWatcher);
 
	} 
 
	private TextWatcher mTextWatcher = new TextWatcher() {
 
		@Override 
		public void afterTextChanged(Editable s) { 
			// Èç¹ûÊDZßд±ß¶Á