get Boot Time String from SystemClock.elapsedRealtime() - Android android.os

Android examples for android.os:SystemClock

Description

get Boot Time String from SystemClock.elapsedRealtime()

Demo Code

import android.os.SystemClock;

public class Main {

  public static String getBootTimeString() {
    long ut = SystemClock.elapsedRealtime() / 1000;
    int h = (int) ((ut / 3600));
    int m = (int) ((ut / 60) % 60);
    return h + ":" + m;
  }/*from w  ww  . ja v  a2  s  .c o m*/

}

Related Tutorials