public class StopWatch
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static interface |
StopWatch.TickListener |
Constructor and Description |
---|
StopWatch() |
StopWatch(boolean processOnStartingThread) |
StopWatch(Handler handler) |
Modifier and Type | Method and Description |
---|---|
int |
getTickDelay()
Retrieves the approximate duration between time updates.
|
long |
getTime()
Retrieves the current time for the stopwatch.
|
boolean |
isRunning()
Determines if the stopwatch is currently running
|
void |
overrideCurrentTime(long time)
Forcefully sets the current time for the stopwatch.
|
void |
reset()
Resets the current time for the stopWatch
|
void |
setTickDelay(int milliSeconds)
Sets the approximate duration between time updates.
|
void |
setTickListener(StopWatch.TickListener listener)
Sets the listener to be notified for each time update (tick)
|
void |
start()
Starts the stopwatch.
|
void |
stop()
Stops the stopwatch, capturing the ending time
|
public StopWatch()
public StopWatch(boolean processOnStartingThread)
processOnStartingThread
- True if the repeating process should be handled on the same thread that created the Repeaterpublic StopWatch(Handler handler)
handler
- The Handler to use for the repeating processpublic void setTickDelay(int milliSeconds)
milliSeconds
- The approximate duration between time updates [default: ]public int getTickDelay()
public void start()
reset()
first.public void stop()
public void reset()
public void overrideCurrentTime(long time)
time
- The new stopwatch time in millisecondspublic boolean isRunning()
public long getTime()
public void setTickListener(StopWatch.TickListener listener)
listener
- The listener or null