다음을 통해 공유


Timer.Schedule Method

Definition

Overloads

Schedule(TimerTask, Date)

Schedules the specified task for execution at the specified time.

Schedule(TimerTask, Int64)

Schedules the specified task for execution after the specified delay.

Schedule(TimerTask, Date, Int64)

Schedules the specified task for repeated fixed-delay execution, beginning at the specified time.

Schedule(TimerTask, Int64, Int64)

Schedules the specified task for repeated fixed-delay execution, beginning after the specified delay.

Schedule(TimerTask, Date)

Schedules the specified task for execution at the specified time.

[Android.Runtime.Register("schedule", "(Ljava/util/TimerTask;Ljava/util/Date;)V", "GetSchedule_Ljava_util_TimerTask_Ljava_util_Date_Handler")]
public virtual void Schedule (Java.Util.TimerTask? task, Java.Util.Date? time);
[<Android.Runtime.Register("schedule", "(Ljava/util/TimerTask;Ljava/util/Date;)V", "GetSchedule_Ljava_util_TimerTask_Ljava_util_Date_Handler")>]
abstract member Schedule : Java.Util.TimerTask * Java.Util.Date -> unit
override this.Schedule : Java.Util.TimerTask * Java.Util.Date -> unit

Parameters

task
TimerTask

task to be scheduled.

time
Date

time at which task is to be executed.

Attributes

Exceptions

if when.getTime() .

if the Timer has been canceled, or if the task has been scheduled or canceled.

Remarks

Schedules the specified task for execution at the specified time. If the time is in the past, the task is scheduled for immediate execution.

Java documentation for java.util.Timer.schedule(java.util.TimerTask, java.util.Date).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Schedule(TimerTask, Int64)

Schedules the specified task for execution after the specified delay.

[Android.Runtime.Register("schedule", "(Ljava/util/TimerTask;J)V", "GetSchedule_Ljava_util_TimerTask_JHandler")]
public virtual void Schedule (Java.Util.TimerTask? task, long delay);
[<Android.Runtime.Register("schedule", "(Ljava/util/TimerTask;J)V", "GetSchedule_Ljava_util_TimerTask_JHandler")>]
abstract member Schedule : Java.Util.TimerTask * int64 -> unit
override this.Schedule : Java.Util.TimerTask * int64 -> unit

Parameters

task
TimerTask

task to be scheduled.

delay
Int64

delay in milliseconds before task is to be executed.

Attributes

Exceptions

if the Timer has been canceled, or if the task has been scheduled or canceled.

Remarks

Schedules the specified task for execution after the specified delay.

Java documentation for java.util.Timer.schedule(java.util.TimerTask, long).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Schedule(TimerTask, Date, Int64)

Schedules the specified task for repeated fixed-delay execution, beginning at the specified time.

[Android.Runtime.Register("schedule", "(Ljava/util/TimerTask;Ljava/util/Date;J)V", "GetSchedule_Ljava_util_TimerTask_Ljava_util_Date_JHandler")]
public virtual void Schedule (Java.Util.TimerTask? task, Java.Util.Date? firstTime, long period);
[<Android.Runtime.Register("schedule", "(Ljava/util/TimerTask;Ljava/util/Date;J)V", "GetSchedule_Ljava_util_TimerTask_Ljava_util_Date_JHandler")>]
abstract member Schedule : Java.Util.TimerTask * Java.Util.Date * int64 -> unit
override this.Schedule : Java.Util.TimerTask * Java.Util.Date * int64 -> unit

Parameters

task
TimerTask

task to be scheduled.

firstTime
Date

First time at which task is to be executed.

period
Int64

time in milliseconds between successive task executions.

Attributes

Exceptions

if when.getTime() or period <= 0.

if the Timer has been canceled, or if the task has been scheduled or canceled.

Remarks

Schedules the specified task for repeated fixed-delay execution, beginning at the specified time. Subsequent executions take place at approximately regular intervals, separated by the specified period.

In fixed-delay execution, each execution is scheduled relative to the actual execution time of the previous execution. If an execution is delayed for any reason (such as garbage collection or other background activity), subsequent executions will be delayed as well. In the long run, the frequency of execution will generally be slightly lower than the reciprocal of the specified period (assuming the system clock underlying Object.wait(long) is accurate). As a consequence of the above, if the scheduled first time is in the past, it is scheduled for immediate execution.

Fixed-delay execution is appropriate for recurring activities that require "smoothness." In other words, it is appropriate for activities where it is more important to keep the frequency accurate in the short run than in the long run. This includes most animation tasks, such as blinking a cursor at regular intervals. It also includes tasks wherein regular activity is performed in response to human input, such as automatically repeating a character as long as a key is held down.

Java documentation for java.util.Timer.schedule(java.util.TimerTask, java.util.Date, long).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Schedule(TimerTask, Int64, Int64)

Schedules the specified task for repeated fixed-delay execution, beginning after the specified delay.

[Android.Runtime.Register("schedule", "(Ljava/util/TimerTask;JJ)V", "GetSchedule_Ljava_util_TimerTask_JJHandler")]
public virtual void Schedule (Java.Util.TimerTask? task, long delay, long period);
[<Android.Runtime.Register("schedule", "(Ljava/util/TimerTask;JJ)V", "GetSchedule_Ljava_util_TimerTask_JJHandler")>]
abstract member Schedule : Java.Util.TimerTask * int64 * int64 -> unit
override this.Schedule : Java.Util.TimerTask * int64 * int64 -> unit

Parameters

task
TimerTask

task to be scheduled.

delay
Int64

delay in milliseconds before task is to be executed.

period
Int64

time in milliseconds between successive task executions.

Attributes

Exceptions

if delay or period <= 0.

if the Timer has been canceled, or if the task has been scheduled or canceled.

Remarks

Schedules the specified task for repeated fixed-delay execution, beginning after the specified delay. Subsequent executions take place at approximately regular intervals separated by the specified period.

In fixed-delay execution, each execution is scheduled relative to the actual execution time of the previous execution. If an execution is delayed for any reason (such as garbage collection or other background activity), subsequent executions will be delayed as well. In the long run, the frequency of execution will generally be slightly lower than the reciprocal of the specified period (assuming the system clock underlying Object.wait(long) is accurate).

Fixed-delay execution is appropriate for recurring activities that require "smoothness." In other words, it is appropriate for activities where it is more important to keep the frequency accurate in the short run than in the long run. This includes most animation tasks, such as blinking a cursor at regular intervals. It also includes tasks wherein regular activity is performed in response to human input, such as automatically repeating a character as long as a key is held down.

Java documentation for java.util.Timer.schedule(java.util.TimerTask, long, long).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to