SystemClock.elapsedRealtime();はdeveloperの公式ページに掲載されています。
https://developer.android.com/reference/android/os/SystemClock
elapsedRealtime() and elapsedRealtimeNanos() return the time since the system was booted, and include deep sleep. This clock is guaranteed to be monotonic, and continues to tick even when the CPU is in power saving modes, so is the recommend basis for general purpose interval timing.
public void startTimer(View view){ // startTimeの取得 startTime = SystemClock.elapsedRealtime(); // 起動してからの経過時間(ミリ秒) // 一定時間ごとに現在の経過時間を表示 // handler -> Runnable(処理) -> UI updateTimer = new Runnable(){ @Override public void run(){ long t = SystemClock.elapsedRealtime() - startTime; SimpleDateFormat sdf = new SimpleDateFormat("mm:ss.SSS", Locale.US); timerLabel.setText(sdf.format(t)); handler.removeCallbacks(updateTimer); handler.postDelayed(updateTimer, 10); } }; handler.postDelayed(updateTimer, 10); // ボタンの操作 setButtonState(false, true, false); }