Code example for TextToSpeech

Methods: areDefaultsEnforcedgetDefaultEnginegetLanguageshutdown

0
 
	@SuppressWarnings("deprecation") 
	private void getDataAboutSound(Context ct) {
		// TTS 
		try { 
			TextToSpeech mTts = new TextToSpeech(ct, null);
			if (mTts != null) {
				results.put("TTS supported", "Yes");
				results.put("TTS defaults enforced", String.valueOf(mTts.areDefaultsEnforced()));
				results.put("TTS default engine", mTts.getDefaultEngine());
				Locale tmpLocale = mTts.getLanguage();
				results.put("TTS default language", tmpLocale.getLanguage());
				results.put("TTS default country", tmpLocale.getCountry());
				if (Build.VERSION.SDK_INT>=14) {
 
					mTts.shutdown();
				} 
			}  
		} catch (Exception e) {
			results.put("TTS supported", "No:\n Error:" + e.toString());
		} 
Stop searching for code, let great code find you!  Add Codota to your java IDE