更新的TextView,每一分钟,在一分钟的最佳方式在一、方式、TextView

由网友(凹凸曼耐上小怪兽)分享简介:我的问题是与此类似,如何更新窗口小部件每分钟,但我只想要更新的用户界面TextView的。我需要访问的时间,所以很遗憾不能简单地用DigitalClock视图。My problem is similar to this one, How to update a widget every minute, however...

我的问题是与此类似,如何更新窗口小部件每分钟,但我只想要更新的用户界面TextView的。我需要访问的时间,所以很遗憾不能简单地用DigitalClock视图。

My problem is similar to this one, How to update a widget every minute, however I only want to update TextView of the UI. I need access to the time so unfortunately can not simply use the DigitalClock view.

我一直研究和发现的方法来更新每一分钟,但不能在一分钟让它们与系统时钟同步(所以他们可能会高达59秒的同步!)

Ive been researching and have found ways to update every minute, but not on the minute so they are synchronised with the system clock (so they might be up to 59 seconds out of sync!)

的唯一途径我能想到这样做是 (一)运行的处理程序(或定时器)每秒(这似乎有点像杀鸡用牛刀,如果我只是想更新每分钟)的就像这起android.com资源

The only ways I can think to do it are (a) Run a handler (or timer) every second (which seems a bit like overkill if I only want to update every minute) Like this from the android.com resources

(二)有在后台运行的服务。 (我并不热衷于这个,因为我已经有了在后台运行更重要的事情)

(b) Have a service running in background. (I'm not keen on this as I already have more important things running in the background)

(三)使用报警管理器(又似乎有点小题大做)

(c) use Alarm Manager (again seems like overkill)

好像是这样一个容易的事,可是......

Seems to be such an easy thing to do, and yet...

任何意见AP preciated 梅尔

Any advice appreciated Mel

推荐答案

您可以尝试配置的定时器的运行的TimerTask 更新您的TextView的每分钟(见的日程法)。

You can try configuring a Timer to run a TimerTask that updates your TextView every minute (see its schedule method).

阅读全文

相关推荐

最新文章