title: Attempt to invoke virtual method 'void android.content.Context.startActivity(android.content.Intent)' on a null object reference
body: <p>I tried to implement a <code>VoiceRecognitionService</code> in Android. In my case after the end of the voice record, I need to start an <code>Intent</code>. But when I'm attempting to do this I got,</p>
  
  <blockquote>
    <p>Attempt to invoke virtual method 'void android.content.Context.startActivity(android.content.Intent)' on a null object reference</p>
  </blockquote>
  
  <p>My class looks like,</p>
  
  <pre><code>public class VoiceRecService extends Application implements RecognitionListener {
      /* other methods and contents */
  
      @Override
  public void onEndOfSpeech() {
          double latitude = 31.249351;
          double longitude = 121.45905;
  
          Intent notificationIntent = new Intent(Intent.ACTION_VIEW, Uri
                  .parse("http://maps.google.com/maps?saddr="
                          + latitude + ","
                          + longitude + "&amp;daddr="
                          + 31.186371 + "," + 121.489885));
          notificationIntent.setPackage("com.google.android.apps.maps");
          notificationIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
          startActivity(notificationIntent);
      }
  }
  </code></pre>
  
  <p>How may I start an intent using <code>startActivity(notificationIntent)</code>. If it's possible, how may I fix this?</p>