Here is a simple example to try out the Text-to-Speech feature in android. It's very simple to just invoke the text to speech engine. Here's the main snippet.
002 | mTts = new TextToSpeech(this, this); |
005 | String language = (String) languageSelector.getSelectedItem(); |
006 | if (languageSelector.getSelectedItemId() == 0) { |
007 | mTts.setLanguage(Locale.ENGLISH); |
009 | mTts.setLanguage(localeMap.get(language)); |
011 | String text = textToConvert.getText().toString(); |
014 | text = "please select the language and enter any text"; |
016 | mTts.speak(text, TextToSpeech.QUEUE_FLUSH, null); |
0 comments:
Post a Comment