Share via


AlertDialog.SetButton Method

Definition

Overloads

SetButton(Int32, String, EventHandler<DialogClickEventArgs>)
SetButton(Int32, String, Message)

Set a message to be sent when a button is pressed.

SetButton(Int32, String, IDialogInterfaceOnClickListener)

Set a listener to be invoked when the specified button of the dialog is pressed.

SetButton(Int32, ICharSequence, EventHandler<DialogClickEventArgs>)
SetButton(Int32, ICharSequence, Message)

Set a message to be sent when a button is pressed.

SetButton(Int32, ICharSequence, IDialogInterfaceOnClickListener)

Set a listener to be invoked when the specified button of the dialog is pressed.

SetButton(ICharSequence, EventHandler<DialogClickEventArgs>)
SetButton(String, Message)
Obsolete.

This member is deprecated.

SetButton(String, IDialogInterfaceOnClickListener)
Obsolete.

Set a listener to be invoked when the specified button of the dialog is pressed.

SetButton(ICharSequence, Message)
Obsolete.

This member is deprecated.

SetButton(ICharSequence, IDialogInterfaceOnClickListener)
Obsolete.

Set a listener to be invoked when the specified button of the dialog is pressed.

SetButton(String, EventHandler<DialogClickEventArgs>)

SetButton(Int32, String, EventHandler<DialogClickEventArgs>)

public void SetButton (int whichButton, string text, EventHandler<Android.Content.DialogClickEventArgs> handler);
member this.SetButton : int * string * EventHandler<Android.Content.DialogClickEventArgs> -> unit

Parameters

whichButton
Int32
text
String

Remarks

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

SetButton(Int32, String, Message)

Set a message to be sent when a button is pressed.

public void SetButton (int whichButton, string? text, Android.OS.Message? msg);
member this.SetButton : int * string * Android.OS.Message -> unit

Parameters

whichButton
Int32

Which button to set the message for, can be one of DialogInterface#BUTTON_POSITIVE, DialogInterface#BUTTON_NEGATIVE, or DialogInterface#BUTTON_NEUTRAL

text
String

The text to display in positive button.

msg
Message

The Message to be sent when clicked.

Remarks

Set a message to be sent when a button is pressed.

Java documentation for android.app.AlertDialog.setButton(int, java.lang.CharSequence, android.os.Message).

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

SetButton(Int32, String, IDialogInterfaceOnClickListener)

Set a listener to be invoked when the specified button of the dialog is pressed.

public void SetButton (int whichButton, string? text, Android.Content.IDialogInterfaceOnClickListener? listener);
member this.SetButton : int * string * Android.Content.IDialogInterfaceOnClickListener -> unit

Parameters

whichButton
Int32

Which button to set the listener on, can be one of DialogInterface#BUTTON_POSITIVE, DialogInterface#BUTTON_NEGATIVE, or DialogInterface#BUTTON_NEUTRAL

text
String

The text to display in positive button.

listener
IDialogInterfaceOnClickListener

The DialogInterface.OnClickListener to use.

Remarks

Java documentation for android.app.AlertDialog.setButton(int, java.lang.CharSequence, android.content.OnClickListener).

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

SetButton(Int32, ICharSequence, EventHandler<DialogClickEventArgs>)

public void SetButton (int whichButton, Java.Lang.ICharSequence text, EventHandler<Android.Content.DialogClickEventArgs> handler);
member this.SetButton : int * Java.Lang.ICharSequence * EventHandler<Android.Content.DialogClickEventArgs> -> unit

Parameters

whichButton
Int32

Remarks

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

SetButton(Int32, ICharSequence, Message)

Set a message to be sent when a button is pressed.

[Android.Runtime.Register("setButton", "(ILjava/lang/CharSequence;Landroid/os/Message;)V", "GetSetButton_ILjava_lang_CharSequence_Landroid_os_Message_Handler")]
public virtual void SetButton (int whichButton, Java.Lang.ICharSequence? text, Android.OS.Message? msg);
[<Android.Runtime.Register("setButton", "(ILjava/lang/CharSequence;Landroid/os/Message;)V", "GetSetButton_ILjava_lang_CharSequence_Landroid_os_Message_Handler")>]
abstract member SetButton : int * Java.Lang.ICharSequence * Android.OS.Message -> unit
override this.SetButton : int * Java.Lang.ICharSequence * Android.OS.Message -> unit

Parameters

whichButton
Int32

Which button to set the message for, can be one of DialogInterface#BUTTON_POSITIVE, DialogInterface#BUTTON_NEGATIVE, or DialogInterface#BUTTON_NEUTRAL

text
ICharSequence

The text to display in positive button.

msg
Message

The Message to be sent when clicked.

Attributes

Remarks

Set a message to be sent when a button is pressed.

Java documentation for android.app.AlertDialog.setButton(int, java.lang.CharSequence, android.os.Message).

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

SetButton(Int32, ICharSequence, IDialogInterfaceOnClickListener)

Set a listener to be invoked when the specified button of the dialog is pressed.

[Android.Runtime.Register("setButton", "(ILjava/lang/CharSequence;Landroid/content/DialogInterface$OnClickListener;)V", "GetSetButton_ILjava_lang_CharSequence_Landroid_content_DialogInterface_OnClickListener_Handler")]
public virtual void SetButton (int whichButton, Java.Lang.ICharSequence? text, Android.Content.IDialogInterfaceOnClickListener? listener);
[<Android.Runtime.Register("setButton", "(ILjava/lang/CharSequence;Landroid/content/DialogInterface$OnClickListener;)V", "GetSetButton_ILjava_lang_CharSequence_Landroid_content_DialogInterface_OnClickListener_Handler")>]
abstract member SetButton : int * Java.Lang.ICharSequence * Android.Content.IDialogInterfaceOnClickListener -> unit
override this.SetButton : int * Java.Lang.ICharSequence * Android.Content.IDialogInterfaceOnClickListener -> unit

Parameters

whichButton
Int32

Which button to set the listener on, can be one of DialogInterface#BUTTON_POSITIVE, DialogInterface#BUTTON_NEGATIVE, or DialogInterface#BUTTON_NEUTRAL

text
ICharSequence

The text to display in positive button.

listener
IDialogInterfaceOnClickListener

The DialogInterface.OnClickListener to use.

Attributes

Remarks

Java documentation for android.app.AlertDialog.setButton(int, java.lang.CharSequence, android.content.OnClickListener).

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

SetButton(ICharSequence, EventHandler<DialogClickEventArgs>)

public void SetButton (Java.Lang.ICharSequence text, EventHandler<Android.Content.DialogClickEventArgs> handler);
member this.SetButton : Java.Lang.ICharSequence * EventHandler<Android.Content.DialogClickEventArgs> -> unit

Parameters

Remarks

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

SetButton(String, Message)

Caution

deprecated

This member is deprecated.

[System.Obsolete("deprecated")]
public void SetButton (string? text, Android.OS.Message? msg);
[<System.Obsolete("deprecated")>]
member this.SetButton : string * Android.OS.Message -> unit

Parameters

text
String

The text to display in positive button.

msg
Message
Attributes

Remarks

This member is deprecated. Use #setButton(int, CharSequence, Message) with DialogInterface#BUTTON_POSITIVE.

Java documentation for android.app.AlertDialog.setButton(java.lang.CharSequence, android.os.Message).

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

SetButton(String, IDialogInterfaceOnClickListener)

Caution

deprecated

Set a listener to be invoked when the specified button of the dialog is pressed.

[System.Obsolete("deprecated")]
public void SetButton (string? text, Android.Content.IDialogInterfaceOnClickListener? listener);
[<System.Obsolete("deprecated")>]
member this.SetButton : string * Android.Content.IDialogInterfaceOnClickListener -> unit

Parameters

text
String

The text to display in positive button.

listener
IDialogInterfaceOnClickListener

The DialogInterface.OnClickListener to use.

Attributes

Remarks

Java documentation for android.app.AlertDialog.setButton(int, java.lang.CharSequence, android.content.OnClickListener).

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

SetButton(ICharSequence, Message)

Caution

deprecated

This member is deprecated.

[Android.Runtime.Register("setButton", "(Ljava/lang/CharSequence;Landroid/os/Message;)V", "GetSetButton_Ljava_lang_CharSequence_Landroid_os_Message_Handler")]
[System.Obsolete("deprecated")]
public virtual void SetButton (Java.Lang.ICharSequence? text, Android.OS.Message? msg);
[<Android.Runtime.Register("setButton", "(Ljava/lang/CharSequence;Landroid/os/Message;)V", "GetSetButton_Ljava_lang_CharSequence_Landroid_os_Message_Handler")>]
[<System.Obsolete("deprecated")>]
abstract member SetButton : Java.Lang.ICharSequence * Android.OS.Message -> unit
override this.SetButton : Java.Lang.ICharSequence * Android.OS.Message -> unit

Parameters

text
ICharSequence

The text to display in positive button.

msg
Message
Attributes

Remarks

This member is deprecated. Use #setButton(int, CharSequence, Message) with DialogInterface#BUTTON_POSITIVE.

Java documentation for android.app.AlertDialog.setButton(java.lang.CharSequence, android.os.Message).

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

SetButton(ICharSequence, IDialogInterfaceOnClickListener)

Caution

deprecated

Set a listener to be invoked when the specified button of the dialog is pressed.

[Android.Runtime.Register("setButton", "(Ljava/lang/CharSequence;Landroid/content/DialogInterface$OnClickListener;)V", "GetSetButton_Ljava_lang_CharSequence_Landroid_content_DialogInterface_OnClickListener_Handler")]
[System.Obsolete("deprecated")]
public virtual void SetButton (Java.Lang.ICharSequence? text, Android.Content.IDialogInterfaceOnClickListener? listener);
[<Android.Runtime.Register("setButton", "(Ljava/lang/CharSequence;Landroid/content/DialogInterface$OnClickListener;)V", "GetSetButton_Ljava_lang_CharSequence_Landroid_content_DialogInterface_OnClickListener_Handler")>]
[<System.Obsolete("deprecated")>]
abstract member SetButton : Java.Lang.ICharSequence * Android.Content.IDialogInterfaceOnClickListener -> unit
override this.SetButton : Java.Lang.ICharSequence * Android.Content.IDialogInterfaceOnClickListener -> unit

Parameters

text
ICharSequence

The text to display in positive button.

listener
IDialogInterfaceOnClickListener

The DialogInterface.OnClickListener to use.

Attributes

Remarks

Java documentation for android.app.AlertDialog.setButton(int, java.lang.CharSequence, android.content.OnClickListener).

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

SetButton(String, EventHandler<DialogClickEventArgs>)

public void SetButton (string text, EventHandler<Android.Content.DialogClickEventArgs> handler);
member this.SetButton : string * EventHandler<Android.Content.DialogClickEventArgs> -> unit

Parameters

text
String

Remarks

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