You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
privatestaticfinalintSPEECH_REQUEST_CODE = 0;
// Create an intent that can start the Speech Recognizer activityprivatevoiddisplaySpeechRecognizer() {
Intentintent = newIntent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
// Start the activity, the intent will be populated with the speech textstartActivityForResult(intent, SPEECH_REQUEST_CODE);
}
// This callback is invoked when the Speech Recognizer returns.// This is where you process the intent and extract the speech text from the intent.@OverrideprotectedvoidonActivityResult(intrequestCode, intresultCode,
Intentdata) {
if (requestCode == SPEECH_REQUEST_CODE && resultCode == RESULT_OK) {
List<String> results = data.getStringArrayListExtra(
RecognizerIntent.EXTRA_RESULTS);
StringspokenText = results.get(0);
// Do something with spokenText
}
super.onActivityResult(requestCode, resultCode, data);
}
Search functionality on the app should support speech input.
Flutter's PluginRegistry.ActivityResultListener
The text was updated successfully, but these errors were encountered: