daily pastebin goal
22%
SHARE
TWEET

Untitled

a guest Jun 19th, 2017 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. private void promptSpeechInput() {
  2.         Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
  3.         intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
  4.                 RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
  5.         intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, Locale.getDefault());
  6.         intent.putExtra(RecognizerIntent.EXTRA_PROMPT,
  7.                 getString(R.string.speech_prompt));
  8.         try {
  9.             startActivityForResult(intent, REQ_CODE_SPEECH_INPUT);
  10.         } catch (ActivityNotFoundException a) {
  11.             Toast.makeText(getApplicationContext(),
  12.                     getString(R.string.speech_not_supported),
  13.                     Toast.LENGTH_SHORT).show();
  14.         }
  15.     }
RAW Paste Data
Top