java - Call a class from a Service, or call a Service from a Class? -


a lot of questions going pop here make in order. 3 guys here managed set service on android application, works charm.

so calling service:

startservice(new intent(getbasecontext(),myservice.class)); 

this service starting activity :

    public int onstartcommand(intent intent,int flage,int startid){  //  toast.maketext(this, "yes please", toast.length_long).show();      intent mintent=new intent(myservice.this,trackingactivity.class);     mintent.setflags(intent.flag_activity_new_task);     startactivity(mintent);      return start_sticky; } 

and when algorithm calculating activity finished set service again: (at end of trackingactivity.class (.java ))

startservice(new intent(getbasecontext(),myservice.class)); 

when hit button after couple of algorithm activations (each time enter 3 float numbers usb algorithm activated) , see previous services each trackingactivity.class opened. (hope explained right).

question #1: ok? mean, there better way setting algorithm infinite loop? (not infinite long application running, service running algorithm running) tried set @ trackingalgorithm.class :

while(true){ algorithm script}  

but never activated algorithm kept looping while.

next issue, not want layout xml attached trackingactivity.class now. question #2: possible? deleting :

setcontentview(r.layout.trackingsub); 

from trackingactivity.class

last issue, algorithm running , need indicator on main screen, bulb. make easy understand, let's algorithm end value binary value, '0' or '1'. want send data indicator , see algorithm background result. question #3: how can that? send data mainactivity? remember: order of application mainactivity->starting service->use activity class inside service.


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -