Created
January 25, 2019 11:31
-
-
Save fevziomurtekin/afe05abb9903aea2e98b537c5ca81f8f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private fun sendMicrophoneMessage(view:View){ | |
val intent: Intent = Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH) | |
intent.putExtra( | |
RecognizerIntent.EXTRA_LANGUAGE_MODEL, | |
RecognizerIntent.LANGUAGE_MODEL_FREE_FORM | |
) | |
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, Locale.getDefault()) | |
intent.putExtra( | |
RecognizerIntent.EXTRA_PROMPT, | |
getString(R.string.speech_prompt) | |
) | |
try { | |
startActivityForResult(intent, SPEECH_INPUT) | |
} catch (a: ActivityNotFoundException) { | |
Toast.makeText( | |
applicationContext, | |
getString(R.string.speech_not_supported), | |
Toast.LENGTH_SHORT | |
).show() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment