Skip to content

Most visited

Recently visited

navigation
Added in API level 1

TimerTask

public abstract class TimerTask
extends Object implements Runnable

java.lang.Object
   ↳ java.util.TimerTask


The TimerTask class represents a task to run at a specified time. The task may be run once or repeatedly.

See also:

Summary

Protected constructors

TimerTask()

Creates a new TimerTask.

Public methods

boolean cancel()

Cancels the TimerTask and removes it from the Timer's queue.

abstract void run()

The task to run should be specified in the implementation of the run() method.

long scheduledExecutionTime()

Returns the scheduled execution time.

Inherited methods

From class java.lang.Object
From interface java.lang.Runnable

Protected constructors

TimerTask

Added in API level 1
TimerTask ()

Creates a new TimerTask.

Public methods

cancel

Added in API level 1
boolean cancel ()

Cancels the TimerTask and removes it from the Timer's queue. Generally, it returns false if the call did not prevent a TimerTask from running at least once. Subsequent calls have no effect.

Returns
boolean true if the call prevented a scheduled execution from taking place, false otherwise.

run

Added in API level 1
void run ()

The task to run should be specified in the implementation of the run() method.

scheduledExecutionTime

Added in API level 1
long scheduledExecutionTime ()

Returns the scheduled execution time. If the task execution is in progress it returns the execution time of the ongoing task. Tasks which have not yet run return an undefined value.

Returns
long the most recent execution time.
This site uses cookies to store your preferences for site-specific language and display options.

Hooray!

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.