title: Why am I getting nullpointerexception listener.onstart(unknown source)?
body: <p>I have a text to speech button on an activity.  The string that is spoken is passed to the listener service class via an intent.  I just recently added super.onStart to the onStart method of the service but Eclipse tells me this is deprecated so I'm wondering if that was the  change I needed to make.  Here's the code:</p>
  
  <pre><code>public class Listener extends Service implements TextToSpeech.OnInitListener {
  
  private String str;
  private TextToSpeech mTts;
  private static final String TAG = "TTSService";
  private ArrayList&lt;Button&gt; b;
  
  @Override
  public IBinder onBind(Intent arg0) {
  
      return null;
  }
  
  @Override
  public void onCreate() {
  
      mTts = new TextToSpeech(this, this // OnInitListener
      );
      mTts.setSpeechRate(0.5f);
  
      super.onCreate();
  }
  
  @Override
  public void onDestroy() {
      // TODO Auto-generated method stub
      if (mTts != null) {
          mTts.stop();
          mTts.shutdown();
          Log.v(TAG, "ondestroy_service");
      }
  
      super.onDestroy();
  }
  
  @Override
  public void onStart(Intent intent, int startId) {
  
      str = intent.getStringExtra("convo");
      sayHello(str);
  
      super.onStart(intent, startId);
  }
  
  @Override
  public void onInit(int status) {
      Log.v(TAG, "oninit");
  
      mTts.setOnUtteranceProgressListener(new UtteranceProgressListener() {
          @Override
          public void onStart(String utteranceID) {
              for (int i = 0; i &lt; ChooseWord.buttonArrayNoClick.size(); i++) {
  
                  ChooseWord.buttonArrayNoClick.get(i).setClickable(false);
              }
  
          }
  
          @Override
          public void onError(String utteranceID) {
  
          }
  
          @Override
          public void onDone(String utteranceID) {
              for (int i = 0; i &lt; ChooseWord.buttonArrayNoClick.size(); i++) {
                  ChooseWord.buttonArrayNoClick.get(i).setClickable(true);
              }
  
          }
      });
      if (status == TextToSpeech.SUCCESS) {
          int result = mTts.setLanguage(Locale.US);
          if (result == TextToSpeech.LANG_MISSING_DATA
                  || result == TextToSpeech.LANG_NOT_SUPPORTED) {
              Log.v(TAG, "Language is not available.");
          } else {
  
              sayHello(str);
  
          }
      } else {
          Log.v(TAG, "Could not initialize TextToSpeech.");
      }
  }
  
  private void sayHello(String str) {
      mTts.speak(str, TextToSpeech.QUEUE_FLUSH, null);
  }
  </code></pre>
  
  <p>}</p>
  
  <p>Here's the error report:</p>
  
  <pre><code>java.lang.RuntimeException: Unable to start service com.mresapp.Listener@42060920 with null:        
  java.lang.NullPointerException
  at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2782)
  at android.app.ActivityThread.access$2000(ActivityThread.java:152)
  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1385)
  at android.os.Handler.dispatchMessage(Handler.java:99)
  at android.os.Looper.loop(Looper.java:137)
  at android.app.ActivityThread.main(ActivityThread.java:5328)
  at java.lang.reflect.Method.invokeNative(Native Method)
  at java.lang.reflect.Method.invoke(Method.java:511)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
  at dalvik.system.NativeStart.main(Native Method)
  Caused by: java.lang.NullPointerException
  at com.homeworkhelper.Listener.onStart(Unknown Source)
  at android.app.Service.onStartCommand(Service.java:450)
  at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2765)
  </code></pre>