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
Check whether your device has any in-built activity that can handle speech to text as follows:
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.
You must override onActivityResult method of your Activity in order to handle Speech to text callback.
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
Step 3: Open your MainActivity.java and replace it source with source of my MainActivity.java as follows:
Step 4: Clean and run the project to see the result.