android - IntentService doesn't want to start -
i want start intentservice activity didn't running. have tried tested using toast or log still didn't give reaction.
is there have gone wrong ?
this activity:
public class backgroundapplication extends activity { @override protected void oncreate(bundle savedinstancestate) { findviewbyid(r.id.cmdserviceia).setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { intent msgintent = new intent(backgroundapplication.this, service2.class); startservice(msgintent); } });
this intentservice :
public class service extends intentservice{ @override protected void onhandleintent(intent intent) { mhandler.post(new displaytoast(this, "service start!")); } public class displaytoast implements runnable { private final context mcontext; string mtext; public displaytoast(context mcontext, string text){ this.mcontext = mcontext; mtext = text; } public void run(){ toast.maketext(mcontext, mtext, toast.length_short).show(); } }
any ideas ?
Comments
Post a Comment