Read More
Read now

How TextToSpeech works in Android

Save

In this article we will read How TextToSpeech works in Android. In Android you can convert text to speech by the help of TextToSpeech class. If you want to use this class you need to instantiate Object of this class and you need to implement TextToSpeech.OnInitListener interface.

Constructor of TextToSpeech class

Let us start code for this.

activity_main

In activity_main.xml we take an edittext and a button.

MainActivity

In TextToSpeech.OnInitListener you have to need properties such as langguages.Language can be set by calling as setLanguage().

Once you have set languege and then you can call speak method.

shutdown()

And by the help of this method you can released the resources used by the TextToSpeech.

stop()

this method used to stop speak.

while you enter text in editeText and then you click on button Text To Speech.

Then your text will be converted to your speech and you can listen voice in real device.

Please check below screenshots we have attached two screenshots. When you enter text to edittext then you will hear voice after clicking on text to speech button.

textToSpeech
textToSpeech1

So Here we discussed  How TextToSpeech works in Android. Thanks for reading this blog and You can get other blogs from here

. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


Be the first to comment.

css.php

Big thanks to Webkul and his team for helping get Opencart 3.0.3.7 release ready!

Deniel Kerr

Owner and Founder. Opencart

Talk to Sales
Start a Project

    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home