service - Why am I getting nullpointerexception listener.onstart(unknown source)? -


i have text speech button on activity. string spoken passed listener service class via intent. added super.onstart onstart method of service eclipse tells me deprecated i'm wondering if change needed make. here's code:

public class listener extends service implements texttospeech.oninitlistener {  private string str; private texttospeech mtts; private static final string tag = "ttsservice"; private arraylist<button> b;  @override public ibinder onbind(intent arg0) {      return null; }  @override public void oncreate() {      mtts = new texttospeech(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) {             (int = 0; < chooseword.buttonarraynoclick.size(); i++) {                  chooseword.buttonarraynoclick.get(i).setclickable(false);             }          }          @override         public void onerror(string utteranceid) {          }          @override         public void ondone(string utteranceid) {             (int = 0; < 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 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); } 

}

here's error report:

java.lang.runtimeexception: unable start service com.mresapp.listener@42060920 null:         java.lang.nullpointerexception @ android.app.activitythread.handleserviceargs(activitythread.java:2782) @ android.app.activitythread.access$2000(activitythread.java:152) @ android.app.activitythread$h.handlemessage(activitythread.java:1385) @ android.os.handler.dispatchmessage(handler.java:99) @ android.os.looper.loop(looper.java:137) @ android.app.activitythread.main(activitythread.java:5328) @ java.lang.reflect.method.invokenative(native method) @ java.lang.reflect.method.invoke(method.java:511) @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:1102) @ com.android.internal.os.zygoteinit.main(zygoteinit.java:869) @ dalvik.system.nativestart.main(native method) caused by: java.lang.nullpointerexception @ com.homeworkhelper.listener.onstart(unknown source) @ android.app.service.onstartcommand(service.java:450) @ android.app.activitythread.handleserviceargs(activitythread.java:2765) 


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -