Hi everyone!

I do have one service running in the background. Whenever it starts I
store in memory the starting time in milliseconds:

startingTime = new Date().getTime();

I want to display a chronometer that starts counting when the service
starts and never stops until the user presses a "Stop" button. I want
to allow the user to leave the activity rendering the chronometer, do
some stuff (browse webpages, use twitdroid, whatever) and then return.

But the idea is that when the user returns I dont want the chronometer
to go to 0:00 again. Insted I want it to show the exact time that has
passed ever since the service has started.

I can calculate elapsedTime every time the user return to the
chronometer activity in the onStart method:

elapsedTime =  new Date().getTime() - startingTime;

The thing is that i dont know how to tell the chronometer to start
counting from that time and not from zero. I have seen the api example
but I have not been able to get this behaviour. I think I have to do
something with the setBase method, butsetting elapsedTime as the
chronometer base does not work.

Can someon explain what exactly "base" means or how to accomplish
this?

thanks a lot! BYE

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to