-
Notifications
You must be signed in to change notification settings - Fork 4
Speech to text
Roman Tcaregorodtcev edited this page Mar 30, 2018
·
1 revision
Starts an activity that will prompt the user for speech and send it through a speech recognizer. The results will be returned via activity results.
OmegaIntentBuilder.from(this)
.speechToText()
.prompt("Say something")
.createIntentHandler()
.failToast("You don't have app for \"Speech to text\"")
.startActivityForResult(new ActivityResultCallback() {
@Override
public void onActivityResult(int resultCode, @Nullable Intent data) {
if (resultCode == RESULT_OK && data != null) {
textView.setText("");
List<String> result = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS);
for (String msg : result) {
textView.append("\n" + msg);
}
}
}
});