Code example for TextToSpeech

Methods: playSilence, speak

	//speak the user text 
	private void speakWords(String speech) {
		//speak straight away 
    	myTTS.speak(speech, TextToSpeech.QUEUE_FLUSH, null);
    	myTTS.playSilence(200, TextToSpeech.QUEUE_FLUSH, null);
	//speak the user text 
	private void generateNewTask() { 
		Random r = new Random();
		number1 = r.nextInt(maxNumber);
		number2 = r.nextInt(maxNumber);
		speakWords(new String(number1 + " plus " + number2 + " equals?"));
	// Instruct the app to listen for user speech input 
	private void listenToSpeech(String task) {
	    //start the speech recognition intent passing required data