title: Android Speech recognition
body: <p>I am trying to create an app that simply detects specific phrases that the user can speak into the device and the activity will do something depending on what the user has spoken. I had a hard time finding tutorials on this specific thing so please help me out. So far I have created a button that will start the Recognizer Intent and I have a onActivityResult which I hope can detect what the user is saying and then call specific functions depending on the phrase the user has spoken. </p>
  
  <pre><code>public void OnClick_Speed_Detector(View v)
  {
      Intent i = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
      i.putExtra(RecognizerIntent.EXTRA_LANGUAGE, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
      i.putExtra(RecognizerIntent.EXTRA_PROMPT, "speak up");
      startActivityForResult(i, 1);
  
  }
  
  protected void onActivityResult(int requestCode, int resultCode, Intent data)
  {
      if(requestCode == 1 &amp;&amp; resultCode == RESULT_OK)
      {
         //if user says the phrase "poptarts"
         //call function poptart
  
        //if user says the phrase "banana"
        //call function banana
  
          Toast.makeText(getApplicationContext(), "sound detected", Toast.LENGTH_LONG).show();
      }
  }
  </code></pre>