Android-如何获得创建按钮的时间

Android - How to get the time of created button

本文关键字:时间 按钮 创建 何获得 Android-      更新时间:2023-10-16

当在布局中创建Button(显示)时,Android中是否有任何功能,可以返回时间。我现在正在使用类似的东西,但是我不知道它返回的时间多么现实。

frameLay.addView(okButton,layoutParams); Date date1 = new Date(); setTimeCreate(date1.getTime());

也许我可以使用C/C 中的一些功能。

ps:对不起,我的英语不是英语的母语

使用:

System.currentTimeMillis() - returns current time in milliseconds.

取决于所需的准确性级别,您可以使用这两个:

System.nanoTime()
System.currentTimeMillis()