android - In a service, why can you make toast in onDestroy() but not onHandleIntent()? -
it's sort of academic how come following displays toast:
public class myservice extends intentservice { public pdfrotateservice() { super("myservice"); // todo auto-generated constructor stub } @override protected void onhandleintent(intent intent) { dosomethings(); } @override public void ondestroy() { super.ondestroy(); toast.maketext(this, text, duration).show(); } }
,but putting toast.maketext() in onhandleintent() instead doesn't display toast?
read documentation understand how each method works. according documentation of intentservice onhandleintent
runs on worker thread that runs independently other application logic. toast
work, has implemented in main ui thread
Comments
Post a Comment