91-9990449935 0120-4256464 |
Android TextToSpeech TutorialIn android, you can convert your text into speech by the help of TextToSpeech class. After completion of the conversion, you can playback or create the sound file. Constructor of TextToSpeech class
Methods of TextToSpeech classThe commonly used methods of TextToSpeech class are as follows:
TextToSpeech.OnInitListener InterfaceYou need to implement TextToSpeech.OnInitListener interface, for performing event handling on TextToSpeech engine. Method of TextToSpeech.OnInitListener InterfaceThere is only one method in this interface.
Android TextToSpeech ExampleLet's write the code to convert text into voice. activity_main.xmlDrag one textview, one edittext and one button for the layout. Now the activity_main.xml file will look like this: File: activity_main.xml
Activity classLet's see the code to speak the given text. File: MainActivity.java
You need to run it on the Real Device (e.g. Mobile) to test the application.Next: TextToSpeech example with speed and pitch optionTextToSpeech example with speed and pitch option
Next TopicAndroid TextToSpeech Example
|