Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void promptSpeechInput() {
- Intent intent = new 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, REQ_CODE_SPEECH_INPUT);
- } catch (ActivityNotFoundException a) {
- Toast.makeText(getApplicationContext(),
- getString(R.string.speech_not_supported),
- Toast.LENGTH_SHORT).show();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement