title: Android speech recognition: startActivityForResult() does not work
body: <p>All you need to know:
  I have a dialog with a button in it. When the button is pressed I want to start the speech recognition in my MainActivity. (The dialog is created by another class, I handle the clicks via an interface).</p>
  
  <p>So here is the relevant code: (in MainActivity)</p>
  
  <pre><code>public void speechToText(boolean isName) {
  
      this.isName = isName;
  
      Intent intent = new Intent(
              RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
  
      intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, Locale.getDefault().toString());
      //intent.putExtra(RecognizerIntent.EXTRA_PROMPT, getString(R.string.prompt));
  
      try {
          startActivityForResult(intent, RESULT_SPEECH);
  
          Toast.makeText(getApplicationContext(),
                  "started acitvity for result",     //test toast
                  Toast.LENGTH_SHORT).show();
  
      } catch (ActivityNotFoundException a) {
          Toast.makeText(getApplicationContext(),
                  getString(R.string.speech_to_text_not_supported),
                  Toast.LENGTH_SHORT).show();
      }
  }
  @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
      super.onActivityResult(requestCode, resultCode, data);
  
      switch (requestCode) {
          case RESULT_SPEECH: {
              if (resultCode == RESULT_OK &amp;&amp; null != data) {
  
                  ArrayList&lt;String&gt; text = data
                          .getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS);
  
                  if(isName)
                      currentName = text.get(0);
                  else
                      currentDes = text.get(0);
  
                  dialog.DialogNew(currentName, currentDes);
              }
              break;
          }
  
      }
  }
  </code></pre>
  
  <p>Here is the problem: Normally a dialog appears for the input of speech. But somehow this dialog won't appear. I've tested it, and it shows the 'test toast' (see above), but there is no error and no input dialog. But Why?</p>
  
  <p><strong>Edit:</strong> I finally could test it on another device and (finally) I got an error: the google dialog was closed. From the protocol, a null pointer exception, so I guess there must be something wrong with my intent.</p>