aspose file tools*
The moose likes Android and the fly likes After starting a service my activity hangs Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Mobile » Android
Bookmark "After starting a service my activity hangs" Watch "After starting a service my activity hangs" New topic
Author

After starting a service my activity hangs

Naishadh Parmar
Ranch Hand

Joined: Jun 02, 2011
Posts: 95

Hey guys,
I have this service

when I start this service with the startService(Intent) method from my Activity. My Activity hangs. Why?
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
At a cursory glance, it seems that the run method of the tAlarm thread does busy waiting without ever stopping or sleeping.
Naishadh Parmar
Ranch Hand

Joined: Jun 02, 2011
Posts: 95

So how do I solve it Tim
Is there an easier way to perform the same function.
I myself know that the thread keeps the phone pretty busy
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
One approach would be to let the thread sleep for 60 seconds after each invocation, since it doesn't do anything on a finer granularity than that.
Naishadh Parmar
Ranch Hand

Joined: Jun 02, 2011
Posts: 95

Oh yeah,
Thanks Tim.
Just one question. Are you an SCJD or something???
Because you are too experienced. You have 2000+ posts and I have seen other threads, your posts are mostly useful and more 'to the point'
Thanks a lot Tim
See you soon
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
Thanks for the kind words; I never knew one could be "too experienced" :-) I don't have any certifications, as I never worked in a job market where any of those would have counted for much. I do have a degree in computer science, though, and that more than makes up for it :-)
 
Don't get me started about those stupid light bulbs.
 
subject: After starting a service my activity hangs
 
Similar Threads
Programmer's Final Exam question #13 (from imon Robert's book)
Application nor run in the background
Create service to run after time
Hurry!!
First day of the first week of the month