• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

After starting a service my activity hangs

 
Ranch Hand
Posts: 95
Python C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey guys,
I have this service

when I start this service with the startService(Intent) method from my Activity. My Activity hangs. Why?
 
Saloon Keeper
Posts: 7585
176
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 95
Python C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Saloon Keeper
Posts: 7585
176
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 95
Python C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Saloon Keeper
Posts: 7585
176
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 :-)
reply
    Bookmark Topic Watch Topic
  • New Topic