Timer.Cancel Method

Definition

Terminates this timer, discarding any currently scheduled tasks.

[Android.Runtime.Register("cancel", "()V", "GetCancelHandler")]
public virtual void Cancel ();
[<Android.Runtime.Register("cancel", "()V", "GetCancelHandler")>]
abstract member Cancel : unit -> unit
override this.Cancel : unit -> unit
Attributes

Remarks

Terminates this timer, discarding any currently scheduled tasks. Does not interfere with a currently executing task (if it exists). Once a timer has been terminated, its execution thread terminates gracefully, and no more tasks may be scheduled on it.

Note that calling this method from within the run method of a timer task that was invoked by this timer absolutely guarantees that the ongoing task execution is the last task execution that will ever be performed by this timer.

This method may be called repeatedly; the second and subsequent calls have no effect.

Java documentation for java.util.Timer.cancel().

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