TimerTask.Cancel Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Cancels this timer task.
[Android.Runtime.Register("cancel", "()Z", "GetCancelHandler")]
public virtual bool Cancel ();
[<Android.Runtime.Register("cancel", "()Z", "GetCancelHandler")>]
abstract member Cancel : unit -> bool
override this.Cancel : unit -> bool
Returns
true if this task is scheduled for one-time execution and has
not yet run, or this task is scheduled for repeated execution.
Returns false if the task was scheduled for one-time execution
and has already run, or if the task was never scheduled, or if
the task was already cancelled. (Loosely speaking, this method
returns true
if it prevents one or more scheduled
executions from taking place.)
- Attributes
Remarks
Cancels this timer task. If the task has been scheduled for one-time execution and has not yet run, or has not yet been scheduled, it will never run. If the task has been scheduled for repeated execution, it will never run again. (If the task is running when this call occurs, the task will run to completion, but will never run again.)
Note that calling this method from within the run
method of a repeating timer task absolutely guarantees that the timer task will not run again.
This method may be called repeatedly; the second and subsequent calls have no effect.
Java documentation for java.util.TimerTask.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.