Code example for TextToSpeech

Methods: setLanguage

0
		} 
	} 
 
	@Override 
	public void onInit(int status) {
		tts.setLanguage(Locale.US);
	} 
 
	public void speak(String string) {
		if (tts != null)
			tts.speak(string, TextToSpeech.QUEUE_FLUSH, null);
	} 
 
	private boolean shouldEnableTTS(Context context) {
		SharedPreferences prefs = PreferenceManager
				.getDefaultSharedPreferences(context);
		return prefs.getBoolean("pref_enable_tts", false);
	} 
}