Code example for TextToSpeech

Methods: isLanguageAvailable, setLanguage, speak

0
		tts.shutdown();
	} 
 
	public void onInit(int status) {
		Locale loc = Locale.getDefault();
		if(tts.isLanguageAvailable(loc) >= TextToSpeech.LANG_AVAILABLE){
			tts.setLanguage(loc);
		} 
		tts.speak("Text to Speach Initialized", TextToSpeech.QUEUE_FLUSH, null);
	} 
 
	@Override 
	public boolean onCreateOptionsMenu(Menu menu) {
		menu.add(Menu.NONE, ADD_ID, Menu.NONE, "Add").setIcon(R.drawable.add64).setAlphabeticShortcut('a');
		menu.add(Menu.NONE, GEO_ID, Menu.NONE, "Geo Loc").setIcon(R.drawable.add64).setAlphabeticShortcut('g');
		menu.add(Menu.NONE, WEATHER_ID, Menu.NONE, "Weather").setIcon(R.drawable.add64).setAlphabeticShortcut('w');
		menu.add(Menu.NONE, PHONE_ID, Menu.NONE, "Phone").setIcon(R.drawable.add64).setAlphabeticShortcut('p');
		menu.add(Menu.NONE, SMS_ID, Menu.NONE, "SMS").setIcon(R.drawable.add64).setAlphabeticShortcut('s');
		 
		return (super.onCreateOptionsMenu(menu));
	}