title: starting another activity from SpeechRecognition service in android?
body: <p><img src="https://i.stack.imgur.com/iMxEh.png" alt="enter image description here">I am working on android application, which recognize the voice and convert the voice into text as a background process, it is working fine yet, but my next step is to open different built-in activities like message, gallery, email camera through intents,
  my code is </p>
  
  <pre><code>public void onResults(Bundle b) {
              ArrayList&lt;String&gt; as = b
                      .getStringArrayList(sr.RESULTS_RECOGNITION);
              String res = "";
              for (int i = 0; i &lt; as.size(); i++) {
                  Log.e("OnResult", as.get(i));
                  res += as.get(i);
  
              }
              if (res.equalsIgnoreCase("message")) {
                  Intent i = new Intent(Intent.ACTION_SEND);
                  i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                  getApplication().startActivity(i);
              }
  
  
          }
  </code></pre>
  
  <p>I am getting exception at this :( 
  Anyone help, I would appreciate , peace, </p>