0

Is there a way to get the real timer of a Chronometer View into a notification ?

I have created a chronometer with this view : http://developer.android.com/reference/android/widget/Chronometer.html

I also have a notification with http://developer.android.com/reference/android/app/NotificationManager.html where I put "chrono started", "chrono in pause".

I would like to add the chrono in my notification, but I don't know how to get the real timer. Is there an event on the chronometer which could say : Every second, I can send the timer value to the activity ?

Another problem : When I quit the app, the chronometer is stopping as well. Is there a way to keep it running, or get back the last value of it at onStart ?

Thanks.

psv
  • 3,147
  • 5
  • 32
  • 67
  • What do you mean by the "real timer" of the Chronometer? See the `setOnChronometerTickListener` method of the Chronometer class. Is this the event you're looking for? – ajw Aug 13 '14 at 12:14
  • Yes, thank you, it's what I was looking for. I read the doc too fast. – psv Aug 13 '14 at 12:33
  • ...and for my other problem, how can I keep the value if the activity is destroyed ? Do I need to create I service ? – psv Aug 13 '14 at 12:34

0 Answers0