views:

133

answers:

1

There are few built in ways to invoke a timer using the Android stack, A good example is the Chronometer. (http://developer.android.com/reference/android/widget/Chronometer.html)

I would like to integrate piece of code (A thread)that implements timer using the Thread.sleep() method

I plan to have a Service tat invoke this thread and communicate with it.

Are there any disadvantages of using the sleep() method over Chronometer?

+2  A: 

It depends if it's sensitive to lifecycle. If your activity or service will be paused your timer will be stopped. Look into Alarm Manager. There are plenty of examples on this site about.

Pentium10