Language

AlertDialog.SetButton Method

Definition

Overloads

Name Description
SetButton(Int32, String, EventHandler<DialogClickEventArgs>)

Configures the selected alert-dialog button from a string and managed click handler.

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>)

Configures the selected alert-dialog button with text and a managed click handler.

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>)

Configures the legacy positive button with text and a managed click handler.

SetButton(String, Message)
Obsolete.

This method was deprecated in API level 15.

SetButton(String, IDialogInterfaceOnClickListener)
Obsolete.

This method was deprecated in API level 15.

SetButton(ICharSequence, Message)
Obsolete.

This method was deprecated in API level 15.

SetButton(ICharSequence, IDialogInterfaceOnClickListener)
Obsolete.

This method was deprecated in API level 15.

SetButton(String, EventHandler<DialogClickEventArgs>)

Configures the legacy positive button from a string and managed click handler.

SetButton(Int32, String, EventHandler<DialogClickEventArgs>)

Configures the selected alert-dialog button from a string and managed click handler.

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

The positive, negative, or neutral button identifier.

text
String

The string to display on the selected button.

handler
EventHandler<DialogClickEventArgs>

The managed button-click handler to wrap as the dialog listener.

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.

Android reference for android.app.AlertDialog.setButton.

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

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

text
String

CharSequence: The text to display in positive button.

listener
IDialogInterfaceOnClickListener

DialogInterface.OnClickListener: The DialogInterface.OnClickListener to use.

Remarks

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

Android reference for android.app.AlertDialog.setButton.

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>)

Configures the selected alert-dialog button with text and a managed click handler.

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

The positive, negative, or neutral button identifier.

text
ICharSequence

The text to display on the selected button.

handler
EventHandler<DialogClickEventArgs>

The managed button-click handler to wrap as the dialog listener.

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.

Android reference for android.app.AlertDialog.setButton.

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

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

text
ICharSequence

CharSequence: The text to display in positive button.

listener
IDialogInterfaceOnClickListener

DialogInterface.OnClickListener: The DialogInterface.OnClickListener to use.

Attributes

Remarks

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

Android reference for android.app.AlertDialog.setButton.

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>)

Configures the legacy positive button with text and a managed click handler.

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

Parameters

text
ICharSequence

The text to display on the legacy positive button.

handler
EventHandler<DialogClickEventArgs>

The managed button-click handler to wrap as the dialog listener.

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 method was deprecated in API level 15.

[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

CharSequence

msg
Message

Message

Attributes

Remarks

This method was deprecated in API level 15. Use setButton(int,CharSequence,Message) with DialogInterface.BUTTON_POSITIVE.

Android reference for android.app.AlertDialog.setButton.

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

This method was deprecated in API level 15.

[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

CharSequence: The text to display in button 1.

listener
IDialogInterfaceOnClickListener

DialogInterface.OnClickListener: The DialogInterface.OnClickListener to use.

Attributes

Remarks

This method was deprecated in API level 15. Use setButton(int,CharSequence,android.content.DialogInterface.OnClickListener) with DialogInterface.BUTTON_POSITIVE

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

Android reference for android.app.AlertDialog.setButton.

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 method was deprecated in API level 15.

[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

CharSequence

msg
Message

Message

Attributes

Remarks

This method was deprecated in API level 15. Use setButton(int,CharSequence,Message) with DialogInterface.BUTTON_POSITIVE.

Android reference for android.app.AlertDialog.setButton.

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

This method was deprecated in API level 15.

[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

CharSequence: The text to display in button 1.

listener
IDialogInterfaceOnClickListener

DialogInterface.OnClickListener: The DialogInterface.OnClickListener to use.

Attributes

Remarks

This method was deprecated in API level 15. Use setButton(int,CharSequence,android.content.DialogInterface.OnClickListener) with DialogInterface.BUTTON_POSITIVE

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

Android reference for android.app.AlertDialog.setButton.

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>)

Configures the legacy positive button from a string and managed click handler.

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

Parameters

text
String

The string to display on the legacy positive button.

handler
EventHandler<DialogClickEventArgs>

The managed button-click handler to wrap as the dialog listener.

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