- Trending Categories
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
How to integrate Android Speech To Text?
Android supports Google inbuilt text to speak API using RecognizerIntent.ACTION_RECOGNIZE_SPEECH. In this example demonstrate about how to integrate Android speech to text.
Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.
Step 2 − Add the following code to res/layout/activity_main.xml.
In this above code we have created one text view and image view. When user click on image view, it will call Google speech to text API and added text to text view.
Step 3 − Add the following code to src/MainActivity.java
In the above code when user click on imageview, it will call intent as shown below -
In the above code, we are called Google API and will get result on onActivityResult() as shown below -
In the above code, we will get the result as Array List so we are taking zero position from array list and appending to text view.
When user click on the mic button, it will call Google API as shown below -
Now we have given input as "Hey GOOGLE". It will append the result as shown below -
Click here to download the project code
- Related Articles
- Converting Speech to Text to Text to Speech in Python
- How to create Text to Speech in an Android App using Kotlin?
- How to integrate Android Snackbar?
- How to Convert Text to Speech in Python?
- How to convert speech to text using JavaScript?
- Text to Speech Examples in Snack
- How to integrate facebook in Android App?
- How to Integrate Google reCAPTCHA in Android?
- How to Integrate MapmyIndia Maps in Android?
- How to Integrate PayPal SDK in Android?
- How to integrate PayPal in an Android app?
- How to integrate Emojis Keyboard in an Android app?
- How to develop a speech recognizer in android without Google API?
- How to Integrate Google Admob Rewarded Video Ads in Android?
- How to Integrate In-App Review API into Android App?
Kickstart Your Career
Get certified by completing the course
IMAGES