codenameone:We 想在每一秒显示系统的确切秒数
codenameone:We want to show the exact seconds of system on each seconds
我们正在努力取得进展 bar.we 想要在进度条上每秒显示系统的精确秒数。
目前我们正在使用 java.util.Calendar cal=Calendar.getInstance();用于获取系统时间。
但它不工作。
你能告诉我如何解决它吗?我的应用程序需要在所有平台(Andriod、IOS、windows)上得到支持,我不想为所有平台单独编写本机代码。
SECOND
是 Java 中的 static final
值,代号一也是如此,因此您实际上是在尝试获取一个永远不会改变的常量的值。 .
System.currentTimeMillis()
returns 以毫秒为单位的 GMT 系统时间。
Calendar c = Calendar.getInstance();
int currentSecond = c.get(Calendar.SECOND);
同时检查 live clock with animation 和代码的演示。
我们正在努力取得进展 bar.we 想要在进度条上每秒显示系统的精确秒数。 目前我们正在使用 java.util.Calendar cal=Calendar.getInstance();用于获取系统时间。 但它不工作。 你能告诉我如何解决它吗?我的应用程序需要在所有平台(Andriod、IOS、windows)上得到支持,我不想为所有平台单独编写本机代码。
SECOND
是 Java 中的 static final
值,代号一也是如此,因此您实际上是在尝试获取一个永远不会改变的常量的值。 .
System.currentTimeMillis()
returns 以毫秒为单位的 GMT 系统时间。
Calendar c = Calendar.getInstance();
int currentSecond = c.get(Calendar.SECOND);
同时检查 live clock with animation 和代码的演示。