這兩種方法有何區別呢?
-
SystemClock.uptimeMillis() // 從開機到現在的毫秒數(手機睡眠的時間不包括在內);
-
System.currentTimeMillis() // 從1970年1月1日 UTC到現在的毫秒數;
第2個時間,是可以通過System.setCurrentTimeMillis修改的,那么,在某些情況下,一但被修改,時間間隔就不準了
特別說明點:AnimationUtils 中明確說了:
/**
* Returns the current animation time in milliseconds.
* This time should be used when invoking
* {@link Animation#setStartTime(long)}. Refer to
* {@link android.os.SystemClock} for more
* information about the different available clocks.
* The clock used by this method is
* <em>not</em> the "wall" clock (it is not
* {@link System#currentTimeMillis}).
*
* @return the current animation time in milliseconds
*
* @see android.os.SystemClock
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/229238.html
標籤:其他
上一篇:Android開發初體驗
