This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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 Android Security Essentials Live Lessons this week in the Android 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 :-)
 
wood burning stoves
 
subject: After starting a service my activity hangs
 
Similar Threads
Create service to run after time
First day of the first week of the month
Application nor run in the background
Programmer's Final Exam question #13 (from imon Robert's book)
Hurry!!