Check Mobile App
Read now
Start a Project

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

Very good company, we did get app extension for Magento 2 website. The support was very good they help us through the process. Webkul team is very supportive, I would recommend them.

Yasser Mohamed

Yasser Mohamed

Talk to Sales

Global

Live Chat
Start a Project

    Message Sent!

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

    Back to Home