Share via


Activity.ShowDialog Method

Definition

Overloads

ShowDialog(Int32, Bundle)
Obsolete.

Show a dialog managed by this activity.

ShowDialog(Int32)
Obsolete.

Simple version of #showDialog(int, Bundle) that does not take any arguments.

ShowDialog(Int32, Bundle)

Caution

deprecated

Show a dialog managed by this activity.

[Android.Runtime.Register("showDialog", "(ILandroid/os/Bundle;)Z", "")]
[System.Obsolete("deprecated")]
public bool ShowDialog (int id, Android.OS.Bundle? args);
[<Android.Runtime.Register("showDialog", "(ILandroid/os/Bundle;)Z", "")>]
[<System.Obsolete("deprecated")>]
member this.ShowDialog : int * Android.OS.Bundle -> bool

Parameters

id
Int32

The id of the managed dialog.

args
Bundle

Arguments to pass through to the dialog. These will be saved and restored for you. Note that if the dialog is already created, #onCreateDialog(int, Bundle) will not be called with the new arguments but #onPrepareDialog(int, Dialog, Bundle) will be. If you need to rebuild the dialog, call #removeDialog(int) first.

Returns

Returns true if the Dialog was created; false is returned if it is not created because #onCreateDialog(int, Bundle) returns false.

Attributes

Remarks

Show a dialog managed by this activity. A call to #onCreateDialog(int, Bundle) will be made with the same id the first time this is called for a given id. From thereafter, the dialog will be automatically saved and restored.

<em>If you are targeting android.os.Build.VERSION_CODES#HONEYCOMB or later, consider instead using a DialogFragment instead.</em>

Each time a dialog is shown, #onPrepareDialog(int, Dialog, Bundle) will be made to provide an opportunity to do any timely preparation.

This member is deprecated. Use the new DialogFragment class with FragmentManager instead; this is also available on older platforms through the Android compatibility package.

Java documentation for android.app.Activity.showDialog(int, android.os.Bundle).

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.

See also

  • Dialog
  • <xref:Android.App.Activity.OnCreateDialog(System.Int32%2c+Android.OS.Bundle)>
  • <xref:Android.App.Activity.OnPrepareDialog(System.Int32%2c+Android.App.Dialog%2c+Android.App.Dialog)>
  • DismissDialog(Int32)
  • RemoveDialog(Int32)

Applies to

ShowDialog(Int32)

Caution

deprecated

Simple version of #showDialog(int, Bundle) that does not take any arguments.

[Android.Runtime.Register("showDialog", "(I)V", "")]
[System.Obsolete("deprecated")]
public void ShowDialog (int id);
[<Android.Runtime.Register("showDialog", "(I)V", "")>]
[<System.Obsolete("deprecated")>]
member this.ShowDialog : int -> unit

Parameters

id
Int32
Attributes

Remarks

Simple version of #showDialog(int, Bundle) that does not take any arguments. Simply calls #showDialog(int, Bundle) with null arguments.

This member is deprecated. Use the new DialogFragment class with FragmentManager instead; this is also available on older platforms through the Android compatibility package.

Java documentation for android.app.Activity.showDialog(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