Activity.OnCreateDialog Method

Definition

Overloads

OnCreateDialog(Int32)
Obsolete.

This member is deprecated.

OnCreateDialog(Int32, Bundle)
Obsolete.

Callback for creating dialogs that are managed (saved and restored) for you by the activity.

OnCreateDialog(Int32)

Caution

deprecated

This member is deprecated.

[Android.Runtime.Register("onCreateDialog", "(I)Landroid/app/Dialog;", "GetOnCreateDialog_IHandler")]
[System.Obsolete("deprecated")]
protected virtual Android.App.Dialog? OnCreateDialog (int id);
[<Android.Runtime.Register("onCreateDialog", "(I)Landroid/app/Dialog;", "GetOnCreateDialog_IHandler")>]
[<System.Obsolete("deprecated")>]
abstract member OnCreateDialog : int -> Android.App.Dialog
override this.OnCreateDialog : int -> Android.App.Dialog

Parameters

id
Int32

Returns

Attributes

Remarks

This member is deprecated. Old no-arguments version of #onCreateDialog(int, Bundle).

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

OnCreateDialog(Int32, Bundle)

Caution

deprecated

Callback for creating dialogs that are managed (saved and restored) for you by the activity.

[Android.Runtime.Register("onCreateDialog", "(ILandroid/os/Bundle;)Landroid/app/Dialog;", "GetOnCreateDialog_ILandroid_os_Bundle_Handler")]
[System.Obsolete("deprecated")]
protected virtual Android.App.Dialog? OnCreateDialog (int id, Android.OS.Bundle? args);
[<Android.Runtime.Register("onCreateDialog", "(ILandroid/os/Bundle;)Landroid/app/Dialog;", "GetOnCreateDialog_ILandroid_os_Bundle_Handler")>]
[<System.Obsolete("deprecated")>]
abstract member OnCreateDialog : int * Android.OS.Bundle -> Android.App.Dialog
override this.OnCreateDialog : int * Android.OS.Bundle -> Android.App.Dialog

Parameters

id
Int32

The id of the dialog.

args
Bundle

The dialog arguments provided to #showDialog(int, Bundle).

Returns

The dialog. If you return null, the dialog will not be created.

Attributes

Remarks

Callback for creating dialogs that are managed (saved and restored) for you by the activity. The default implementation calls through to #onCreateDialog(int) for compatibility.

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

If you use #showDialog(int), the activity will call through to this method the first time, and hang onto it thereafter. Any dialog that is created by this method will automatically be saved and restored for you, including whether it is showing.

If you would like the activity to manage saving and restoring dialogs for you, you should override this method and handle any ids that are passed to #showDialog.

If you would like an opportunity to prepare your dialog before it is shown, override #onPrepareDialog(int, Dialog, Bundle).

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.onCreateDialog(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

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

Applies to