Code example for TimeUnit

Methods: sleeptoMillis

0
    Log.i(LOG_TAG, "ExampleService started");
 
    timeout = args.getIntExtra(EXTRA_TIMEOUT, DEFAULT_TIMEOUT);
 
    try { 
      Thread.sleep(TimeUnit.SECONDS.toMillis(timeout));
    } catch (final InterruptedException e) {
      e.printStackTrace();
    } 
 
    Log.i(LOG_TAG, "ExampleService finished");
  } 
 
} 
Experience pair programming with AI  Get Codota for Java