Android Tutorial Voice Recognition Example

A large button is displayed. When the user presses on the button, the user is asked to say something.
The voice recognition engine converts the audio to text.

Then the text is converted back to speech using the TTS (text to speech) library:
'Activity module
Sub Process_Globals
    Dim VR As VoiceRecognition
    Dim TTS1 As TTS
End Sub

Sub Globals

End Sub

Sub Activity_Create(FirstTime As Boolean)
    If FirstTime Then
    End If
    If VR.IsSupported Then
        ToastMessageShow("Voice recognition is supported.", False)
        ToastMessageShow("Voice recognition is not supported.", True)
    End If
    VR.Prompt = "Say your message"
End Sub

Sub Button1_Click
    VR.Listen 'calls the voice recognition external activity. Result event will be raised.
End Sub

Sub VR_Result (Success As Boolean, Texts As List)
    If Success = True Then
        ToastMessageShow(Texts.Get(0), True)
        TTS1.Speak(Texts.Get(0), True)
    End If
End Sub
VR is a VoiceRecognition object. We call its Listen method. This method launches the external voice recognition application. When the result is ready the Result event is raised.
We need to check the Success flag to make sure that there is at least one text available.
The Texts list holds all the possible results. We take the supposedly best one which is the first.
The program is attached.


    5.6 KB · Views: 4,930


Active Member
Licensed User
I am looking for a way to use this with the built in textbox on my phone so I can use it to text with.

How can I use the VR example to put text into the textbox when I am texting ?


Licensed User
Once you get the returned list, you can set the textbox to anything in that list.

Sent from my DROID RAZR using Tapatalk 2


Licensed User
Voice recognition needs internet connection

From what I can tell the voice recognition only works if you have a valid internet connection. It has to hit a web server and be returned with the result for it to work. :sign0148:

Does anyone know if there is a workaround for this or if there is another voice recognition engine available?



Licensed User
VoiceRecognition is based on the RecognizerIntent object.
RecognitionListener is for solutions based on SpeechRecognizer API (a newer API).

Hi Erel,

Do you have any plans to support the SpeechRecognizer API so that we can do things like:

1) Record the incoming audio to a file in addition to having it converted to text via the google SR server.

2) Perform Speech-to-text within our apps without displaying the default "Speak Now" prompt.

My main need is #1 so I can do speech-to-text, but yet still save a copy of the original audio in case the speech-to-text didn't perform well - this way the user can play the file at a later time to hear the accurate words they spoke.

Dirk A

Licensed User
Where can I find a list of supported languages + the abbreviations to set Vr.language to ?


Active Member
Licensed User
Is there any way to control the length of time that the VR listens for?
Ideally I would like it to listen until I hit a 'Stop' button - which could be up to 30 seconds?

Edit: Just realised it listens until theres a break in speech

Then, another related question might be "Is there a way to set how long a pause can be before VR stops listening?"

I have several VR & device control related questions. Should I start a new thread?



Licensed User
Hi, Erel!
When you have a multiple language, can you select the language to be recognized? In the text message, it gives a list to select the language.
Thanks in advance for your answer.


Well-Known Member
Licensed User
erel how can i make a button to stop ? and dont stop automatic ?

i want talk a text and when i want stop i click at stop button *-*

Unfortunately I don't think this is possible. I asked the same question and the length of time is not configurable.