I've looked at the Android example for VoiceRecognition, but I don't really understand what it is suppose to do or how it works. In the manifest there isn't any sort of main activity to run and so when I install the app on my phone I can't run it.
I'm also trying to find a simple example of Speech to text that takes speech as input and outputs the text on the screen. Just so I can study it to see how it works, but I haven't been able to find any sort of example on the web that shows it.
I did it like that:
in onCreate:
List<ResolveInfo> activities = pm.queryIntentActivities(new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH), 0);
In the method starting the voice recognition:
Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
intent.putExtra(RecognizerIntent.EXTRA_PROMPT, "Voice recognition Demo...");
startActivityForResult(intent, REQUEST_CODE);
onActivityResult:
protected void onActivityResult(int requestCode, int resultCode, Intent data)
{
if (requestCode == REQUEST_CODE && resultCode == RESULT_OK)
{
// Populate the wordsList with the String values the recognition engine thought it heard
ArrayList<String> matches = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS);
}
}
Hope I'm not missing anything, been a time since. Drop me a note if something doesn't work. About the text output: I'm sure you can handle that once you have a populated matches array.