Språk

Handler.RemoveCallbacks Method

Definition

Overloads

Name Description
RemoveCallbacks(IRunnable, Object)

Remove any pending posts of Runnable r with Object token that are in the message queue.

RemoveCallbacks(Action, Object)

Attempts to remove the tracked callback for the specified action and token from this handler's queue.

RemoveCallbacks(Action)

Attempts to remove the tracked callback for the specified action from this handler's queue.

RemoveCallbacks(IRunnable)

Remove any pending posts of Runnable r that are in the message queue.

RemoveCallbacks(IRunnable, Object)

Remove any pending posts of Runnable r with Object token that are in the message queue.

[Android.Runtime.Register("removeCallbacks", "(Ljava/lang/Runnable;Ljava/lang/Object;)V", "")]
public void RemoveCallbacks(Java.Lang.IRunnable r, Java.Lang.Object? token);
[<Android.Runtime.Register("removeCallbacks", "(Ljava/lang/Runnable;Ljava/lang/Object;)V", "")>]
member this.RemoveCallbacks : Java.Lang.IRunnable * Java.Lang.Object -> unit

Parameters

r
IRunnable

The value cannot be null.

token
Object

The value may be null.

Attributes

Remarks

Remove any pending posts of Runnable r with Object token that are in the message queue. If token is null, all callbacks will be removed.

This operation is worst case O(n) in the number of messages in the queue, and should be avoided. Instead consider another mechanism outside of the queue to cancel a pending operation. For instance, maintain a flag to indicate whether the operation should be performed differently or not at all once it is dispatched.

Java documentation for android.os.Handler.removeCallbacks(java.lang.Runnable, java.lang.Object).

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

RemoveCallbacks(Action, Object)

Attempts to remove the tracked callback for the specified action and token from this handler's queue.

public void RemoveCallbacks(Action action, Java.Lang.Object token);
member this.RemoveCallbacks : Action * Java.Lang.Object -> unit

Parameters

action
Action

The action whose callback should be removed.

token
Object

The token associated with the callback.

Remarks

The managed binding tracks only one runnable per action instance, including across handlers. Posting the same instance multiple times or executing an earlier post can leave pending callbacks without a tracked runnable.

Tracking is removed before the token is matched, so a nonmatching token can leave a callback in the queue without a tracked runnable.

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

RemoveCallbacks(Action)

Attempts to remove the tracked callback for the specified action from this handler's queue.

public void RemoveCallbacks(Action action);
member this.RemoveCallbacks : Action -> unit

Parameters

action
Action

The action whose callback should be removed.

Remarks

The managed binding tracks only one runnable per action instance, including across handlers. Posting the same instance multiple times or executing an earlier post can leave pending callbacks without a tracked runnable.

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

RemoveCallbacks(IRunnable)

Remove any pending posts of Runnable r that are in the message queue.

[Android.Runtime.Register("removeCallbacks", "(Ljava/lang/Runnable;)V", "")]
public void RemoveCallbacks(Java.Lang.IRunnable r);
[<Android.Runtime.Register("removeCallbacks", "(Ljava/lang/Runnable;)V", "")>]
member this.RemoveCallbacks : Java.Lang.IRunnable -> unit

Parameters

r
IRunnable

The value cannot be null.

Attributes

Remarks

Remove any pending posts of Runnable r that are in the message queue.

This operation is worst case O(n) in the number of messages in the queue, and should be avoided. Instead consider another mechanism outside of the queue to cancel a pending operation. For instance, maintain a flag to indicate whether the operation should be performed differently or not at all once it is dispatched.

Java documentation for android.os.Handler.removeCallbacks(java.lang.Runnable).

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