Text to Speech App converts the text written on the screen to speech like you have written “Hello World” on the screen and when you press the button it will speak “Hello World”. Text-to-speech is commonly used as an accessibility feature to help people who have trouble reading on-screen text, but it’s also convenient for those who want to be read too. This feature has come out to be a very common and useful feature for the users.
Go to the app -> res -> layout -> activity_main.xml section and set the layout for the app. In this file add an EditText to input the text from the user, a Button, so whenever the user clicks on the Button then it’s converted to speech and a TextView to display the GeeksforGeeks text. Below is the complete code for the activity_main.xml file.
Go to the app -> java -> com.example.GFG(Package Name) -> MainActivity.java section. Now join the Button and Edittext to Java code and comments are added inside code to understand the code easily. Below is the complete code for the MainActivity.java file.
Please Login to comment...