简体   繁体   中英

How do i get service timer for my video recording application?

Hi guys i wanted a "service" timer which enable my camera to show the elapsed(incremental) time of a timer when the video recording process has started in such a format 00:00:00? But i do not know how to code the above function in a service activity since it poses the problem of not allowing xml content to link with my mainActivity which in my case is a video recording activity to update the elapsed time on a textview, correct me if i'm wrong or is there a work around/solution?

And when the camera exits and returns the service should still keep track of the time since started and update the textview accordingly... Can someone help me on this matter i'm rather new to android/java programming?

This is what i have tried out so far for my mainActivity which performs the recording and display the updated elapsed time of the timer..

There may be a better answer, but you could just obtain the time when the recording starts and remember it. It's not clear what owns the textview, but whatever does could update it from the current time by subtracting the start time. You can also pass the service a callback handler which it could use to send you update messages.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM