Compartir a través de


Handler.ObtainMessage Method

Definition

Overloads

ObtainMessage()

Returns a new android.os.Message Message from the global message pool.

ObtainMessage(Int32)

Same as #obtainMessage(), except that it also sets the what member of the returned Message.

ObtainMessage(Int32, Object)

Same as #obtainMessage(), except that it also sets the what and obj members of the returned Message.

ObtainMessage(Int32, Int32, Int32)

Same as #obtainMessage(), except that it also sets the what, arg1 and arg2 members of the returned Message.

ObtainMessage(Int32, Int32, Int32, Object)

Same as #obtainMessage(), except that it also sets the what, obj, arg1,and arg2 values on the returned Message.

ObtainMessage()

Returns a new android.os.Message Message from the global message pool.

[Android.Runtime.Register("obtainMessage", "()Landroid/os/Message;", "")]
public Android.OS.Message ObtainMessage ();
[<Android.Runtime.Register("obtainMessage", "()Landroid/os/Message;", "")>]
member this.ObtainMessage : unit -> Android.OS.Message

Returns

Attributes

Remarks

Returns a new android.os.Message Message from the global message pool. More efficient than creating and allocating new instances. The retrieved message has its handler set to this instance (Message.target == this). If you don't want that facility, just call Message.obtain() instead.

Java documentation for android.os.Handler.obtainMessage().

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

ObtainMessage(Int32)

Same as #obtainMessage(), except that it also sets the what member of the returned Message.

[Android.Runtime.Register("obtainMessage", "(I)Landroid/os/Message;", "")]
public Android.OS.Message ObtainMessage (int what);
[<Android.Runtime.Register("obtainMessage", "(I)Landroid/os/Message;", "")>]
member this.ObtainMessage : int -> Android.OS.Message

Parameters

what
Int32

Value to assign to the returned Message.what field.

Returns

A Message from the global message pool.

Attributes

Remarks

Same as #obtainMessage(), except that it also sets the what member of the returned Message.

Java documentation for android.os.Handler.obtainMessage(int).

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

ObtainMessage(Int32, Object)

Same as #obtainMessage(), except that it also sets the what and obj members of the returned Message.

[Android.Runtime.Register("obtainMessage", "(ILjava/lang/Object;)Landroid/os/Message;", "")]
public Android.OS.Message ObtainMessage (int what, Java.Lang.Object? obj);
[<Android.Runtime.Register("obtainMessage", "(ILjava/lang/Object;)Landroid/os/Message;", "")>]
member this.ObtainMessage : int * Java.Lang.Object -> Android.OS.Message

Parameters

what
Int32

Value to assign to the returned Message.what field.

obj
Object

Value to assign to the returned Message.obj field.

Returns

A Message from the global message pool.

Attributes

Remarks

Same as #obtainMessage(), except that it also sets the what and obj members of the returned Message.

Java documentation for android.os.Handler.obtainMessage(int, 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

ObtainMessage(Int32, Int32, Int32)

Same as #obtainMessage(), except that it also sets the what, arg1 and arg2 members of the returned Message.

[Android.Runtime.Register("obtainMessage", "(III)Landroid/os/Message;", "")]
public Android.OS.Message ObtainMessage (int what, int arg1, int arg2);
[<Android.Runtime.Register("obtainMessage", "(III)Landroid/os/Message;", "")>]
member this.ObtainMessage : int * int * int -> Android.OS.Message

Parameters

what
Int32

Value to assign to the returned Message.what field.

arg1
Int32

Value to assign to the returned Message.arg1 field.

arg2
Int32

Value to assign to the returned Message.arg2 field.

Returns

A Message from the global message pool.

Attributes

Remarks

Same as #obtainMessage(), except that it also sets the what, arg1 and arg2 members of the returned Message.

Java documentation for android.os.Handler.obtainMessage(int, int, int).

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

ObtainMessage(Int32, Int32, Int32, Object)

Same as #obtainMessage(), except that it also sets the what, obj, arg1,and arg2 values on the returned Message.

[Android.Runtime.Register("obtainMessage", "(IIILjava/lang/Object;)Landroid/os/Message;", "")]
public Android.OS.Message ObtainMessage (int what, int arg1, int arg2, Java.Lang.Object? obj);
[<Android.Runtime.Register("obtainMessage", "(IIILjava/lang/Object;)Landroid/os/Message;", "")>]
member this.ObtainMessage : int * int * int * Java.Lang.Object -> Android.OS.Message

Parameters

what
Int32

Value to assign to the returned Message.what field.

arg1
Int32

Value to assign to the returned Message.arg1 field.

arg2
Int32

Value to assign to the returned Message.arg2 field.

obj
Object

Value to assign to the returned Message.obj field.

Returns

A Message from the global message pool.

Attributes

Remarks

Same as #obtainMessage(), except that it also sets the what, obj, arg1,and arg2 values on the returned Message.

Java documentation for android.os.Handler.obtainMessage(int, int, int, 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