Skip to content

Instantly share code, notes, and snippets.

@catalinghita8
Last active July 6, 2020 18:55
Show Gist options
  • Select an option

  • Save catalinghita8/fc7efe30aeadac0e5d9f51202a97aef2 to your computer and use it in GitHub Desktop.

Select an option

Save catalinghita8/fc7efe30aeadac0e5d9f51202a97aef2 to your computer and use it in GitHub Desktop.
private fun requestExtractQuery(bundle: Bundle?) {
val data = bundle?.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION)
data?.let { results ->
val resultedText = results[0] // First we set the text result to a TextView
txtSpeechInput.text = resultedText
// Secondly, we send a processing command downstream to the viewModel
// In return, we get a colorized text result with the noun highlighted and we set it again
val result: Spannable = viewModel.requestQuery(resultedText)
txtSpeechInput.text = result
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment