Android Speech to text


Download Speech to text sample

Speech to text demo

Android provide a very cool features which we can use to convert voice to text. Using RecognizerIntent we can use inbuilt activity to convert speech to text

How to check whether your device has any in-built activity that can handle speech to text?


Check whether your device has any in-built activity that can handle speech to text as follows:

How to start Speech to text Activity?


Here is simple step to start Speech to text activity:

Here I am using default language, which you can change if you wish to do so. If you want that Speech to text work in offline also then you must have to download your selected language.

How to onActivityResult of Speech to text?


You must override onActivityResult method of your Activity in order to handle Speech to text callback.

Android Speech to text demo

Step 1: Create a new project in Android Studio and name it Speech to text.

Step 2: Open res -> layout -> activity_main.xml and add following code

activity_main.xml

Step 3: Open your MainActivity.java and replace it source with source of my MainActivity.java as follows:

MainActivity.java

Step 4: Clean and run the project to see the result.


Share & Like

Tutorial topics

About ApnaTutorials.com

ApnaTutorials.com is for Java, J2ee, Html5 and android developers. All tutorials are well explained and are easy to understand. We have tested every tutorials on our developement environment before posting it in public domain.