title: texttospeak interface speak method is not working
body: <p>I am working on app in which when a new activity start, then it should speak some word but in speak method is always showing me null pointer exception but on googling, it shows me we can pass null value. my method is as follows: </p>
  
  <pre><code>private void speakout(String textToSpeak) {         
      HashMap&lt;String, String&gt; myHashAlarm = new HashMap();        
      myHashAlarm.put(TextToSpeech.Engine.KEY_PARAM_STREAM,
      String.valueOf(AudioManager.STREAM_ALARM));         
      tts.speak(textToSpeak, TextToSpeech.QUEUE_FLUSH, null);
  }
  </code></pre>
  
  <p>Here is my logcat output:</p>
  
  <pre class="lang-none prettyprint-override"><code>11-21 12:14:18.985: I/System.out(307): ip : 10.184.211.143 11-21
  12:14:19.035: D/AndroidRuntime(307): Shutting down VM 11-21
  12:14:19.035: W/dalvikvm(307): threadid=1: thread exiting with
  uncaught exception (group=0x4001d800) 11-21 12:14:19.045:
  E/AndroidRuntime(307): FATAL EXCEPTION: main 11-21 12:14:19.045:
  E/AndroidRuntime(307): java.lang.RuntimeException: Unable to
  instantiate activity
  ComponentInfo{com.example.audiobus/com.example.audiobus.AudioBusActivity}:
  java.lang.NullPointerException 11-21 12:14:19.045:
  E/AndroidRuntime(307):  at
  android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2585)
  11-21 12:14:19.045: E/AndroidRuntime(307):  at
  android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
  11-21 12:14:19.045: E/AndroidRuntime(307):  at
  android.app.ActivityThread.access$2300(ActivityThread.java:125) 11-21
  12:14:19.045: E/AndroidRuntime(307):    at
  android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
  11-21 12:14:19.045: E/AndroidRuntime(307):  at
  android.os.Handler.dispatchMessage(Handler.java:99) 11-21
  12:14:19.045: E/AndroidRuntime(307):    at
  android.os.Looper.loop(Looper.java:123) 11-21 12:14:19.045:
  E/AndroidRuntime(307):  at
  android.app.ActivityThread.main(ActivityThread.java:4627) 11-21
  12:14:19.045: E/AndroidRuntime(307):    at
  java.lang.reflect.Method.invokeNative(Native Method) 11-21
  12:14:19.045: E/AndroidRuntime(307):    at
  ...
  </code></pre>
  
  <p>my first edit where i am calling speak out method and intent thing .....</p>
  
  <pre><code>protected void onCreate(Bundle savedInstanceState) {
  
              super.onCreate(savedInstanceState);
  
          setContentView(R.layout.activity_audio_bus);
          textView = (EditText) findViewById(R.id.ipEditText);
          welcomeNote= (TextView) findViewById(R.id.welcomeTextView);
          text = welcomeNote.getText().toString();
          text.concat(" , Please wait we are retriving information");
          System.out.println(text);
          speakout(text);
          Bundle bunble=getIntent().getExtras();
          if(bunble!=null){
                 //Getting the value stored in the name "IP"
              String IP=bunble.getString("IP");
              System.out.println(IP);
                      //appending the value to the contents of textView.
               textView.append(" HI "+IP);
             }
  
          }
  </code></pre>