Dialog Dialog Class

Definition

Base class for Dialogs.

[Android.Runtime.Register("android/app/Dialog", ApiSince=1, DoNotGenerateAcw=true)]
public class Dialog : Java.Lang.Object, Android.Content.IDialogInterface, Android.Views.KeyEvent.ICallback, Android.Views.View.IOnCreateContextMenuListener, Android.Views.Window.ICallback, IDisposable
type Dialog = class
    inherit Object
    interface IDialogInterface
    interface IJavaObject
    interface IDisposable
    interface KeyEvent.ICallback
    interface View.IOnCreateContextMenuListener
    interface Window.ICallback
Inheritance
Derived
Attributes
Implements

Remarks

Android platform documentation

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.

Constructors

Dialog(Context) Dialog(Context)

Creates a dialog window that uses the default dialog theme.

Dialog(Context, Boolean, EventHandler) Dialog(Context, Boolean, EventHandler)
Dialog(Context, Boolean, IDialogInterfaceOnCancelListener) Dialog(Context, Boolean, IDialogInterfaceOnCancelListener)
Dialog(Context, Int32) Dialog(Context, Int32)

Creates a dialog window that uses a custom dialog style.

Dialog(IntPtr, JniHandleOwnership) Dialog(IntPtr, JniHandleOwnership)

A constructor used when creating managed representations of JNI objects; called by the runtime.

Properties

ActionBar ActionBar

Retrieve the ActionBar attached to this dialog, if present.

Class Class

Returns the unique instance of Class that represents this object's class.

(Inherited from Object)
Context Context

Retrieve the Context this Dialog is running in.

CurrentFocus CurrentFocus

Call CurrentFocus on the Window if this Activity to return the currently focused view.

Handle Handle

The handle to the underlying Android instance.

(Inherited from Object)
IJavaObjectEx.IsProxy IJavaObjectEx.IsProxy Inherited from Object
IJavaObjectEx.KeyHandle IJavaObjectEx.KeyHandle Inherited from Object
IJavaObjectEx.NeedsActivation IJavaObjectEx.NeedsActivation Inherited from Object
IJavaPeerable.JniManagedPeerState IJavaPeerable.JniManagedPeerState Inherited from Object
IsShowing IsShowing
JniIdentityHashCode JniIdentityHashCode Inherited from Object
JniPeerMembers JniPeerMembers
LayoutInflater LayoutInflater
OwnerActivity OwnerActivity

Returns the Activity that owns this Dialog.

PeerReference PeerReference Inherited from Object
SearchEvent SearchEvent
ThresholdClass ThresholdClass

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

ThresholdType ThresholdType

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

VolumeControlStream VolumeControlStream
Window Window

Retrieve the current Window for the activity.

Methods

AddContentView(View, ViewGroup+LayoutParams) AddContentView(View, ViewGroup+LayoutParams)

Add an additional content view to the screen.

Cancel() Cancel()

Cancel the dialog.

Clone() Clone()

Creates and returns a copy of this Object.

(Inherited from Object)
CloseOptionsMenu() CloseOptionsMenu()
Create() Create()

Forces immediate creation of the dialog.

Dismiss() Dismiss()

Dismiss this dialog, removing it from the screen.

DispatchGenericMotionEvent(MotionEvent) DispatchGenericMotionEvent(MotionEvent)

Called to process generic motion events.

DispatchKeyEvent(KeyEvent) DispatchKeyEvent(KeyEvent)

Called to process key events.

DispatchKeyShortcutEvent(KeyEvent) DispatchKeyShortcutEvent(KeyEvent)

Called to process a key shortcut event.

DispatchPopulateAccessibilityEvent(AccessibilityEvent) DispatchPopulateAccessibilityEvent(AccessibilityEvent)

Called to process population of AccessibilityEvents.

DispatchTouchEvent(MotionEvent) DispatchTouchEvent(MotionEvent)

Called to process touch screen events.

DispatchTrackballEvent(MotionEvent) DispatchTrackballEvent(MotionEvent)

Called to process trackball events.

Dispose() Dispose() Inherited from Object
Dispose(Boolean) Dispose(Boolean) Inherited from Object
Equals(Object) Equals(Object)

Compares this instance with the specified object and indicates if they are equal.

(Inherited from Object)
FindViewById(Int32) FindViewById(Int32)

Finds a child view with the given identifier.

FindViewById<T>(Int32) FindViewById<T>(Int32)
GetHashCode() GetHashCode()

Returns an integer hash code for this object.

(Inherited from Object)
Hide() Hide()

Hide the dialog, but do not dismiss it.

InvalidateOptionsMenu() InvalidateOptionsMenu()
JavaFinalize() JavaFinalize()

Invoked when the garbage collector has detected that this instance is no longer reachable.

(Inherited from Object)
Notify() Notify()

Causes a thread which is waiting on this object's monitor (by means of calling one of the wait() methods) to be woken up.

(Inherited from Object)
NotifyAll() NotifyAll()

Causes all threads which are waiting on this object's monitor (by means of calling one of the wait() methods) to be woken up.

(Inherited from Object)
OnActionModeFinished(ActionMode) OnActionModeFinished(ActionMode)

Called when an action mode has been finished.

OnActionModeStarted(ActionMode) OnActionModeStarted(ActionMode)

Called when an action mode has been started.

OnAttachedToWindow() OnAttachedToWindow()

Called when the window has been attached to the window manager.

OnBackPressed() OnBackPressed()

Called when the dialog has detected the user's press of the back key.

OnContentChanged() OnContentChanged()

This hook is called whenever the content view of the screen changes (due to a call to M:Android.Views.Window.SetContentView(Android.Views.View,.LayoutParams) or AddContentView(View, ViewGroup+LayoutParams)).

OnContextItemSelected(IMenuItem) OnContextItemSelected(IMenuItem)
OnContextMenuClosed(IMenu) OnContextMenuClosed(IMenu)
OnCreate(Bundle) OnCreate(Bundle)

Similar to OnCreate(Bundle), you should initialize your dialog in this method, including calling SetContentView(View).

OnCreateContextMenu(IContextMenu, View, IContextMenuContextMenuInfo) OnCreateContextMenu(IContextMenu, View, IContextMenuContextMenuInfo)

Called when the context menu for this view is being built.

OnCreateOptionsMenu(IMenu) OnCreateOptionsMenu(IMenu)

It is usually safe to proxy this call to the owner activity's OnCreateOptionsMenu(IMenu) if the client desires the same menu for this Dialog.

OnCreatePanelMenu(Int32, IMenu) OnCreatePanelMenu(Int32, IMenu)

Initialize the contents of the menu for panel 'featureId'.

OnCreatePanelView(Int32) OnCreatePanelView(Int32)

Instantiate the view to display in the panel for 'featureId'.

OnDetachedFromWindow() OnDetachedFromWindow()

Called when the window has been attached to the window manager.

OnGenericMotionEvent(MotionEvent) OnGenericMotionEvent(MotionEvent)

Called when a generic motion event was not handled by any of the views inside of the dialog.

OnKeyDown(Keycode, KeyEvent) OnKeyDown(Keycode, KeyEvent)

A key was pressed down.

OnKeyLongPress(Keycode, KeyEvent) OnKeyLongPress(Keycode, KeyEvent)

Default implementation of OnKeyLongPress(Keycode, KeyEvent): always returns false (doesn't handle the event).

OnKeyMultiple(Keycode, Int32, KeyEvent) OnKeyMultiple(Keycode, Int32, KeyEvent)

Default implementation of OnKeyMultiple(Keycode, Int32, KeyEvent): always returns false (doesn't handle the event).

OnKeyShortcut(Keycode, KeyEvent) OnKeyShortcut(Keycode, KeyEvent)

Called when a key shortcut event is not handled by any of the views in the Dialog.

OnKeyUp(Keycode, KeyEvent) OnKeyUp(Keycode, KeyEvent)

A key was released.

OnMenuItemSelected(Int32, IMenuItem) OnMenuItemSelected(Int32, IMenuItem)

Called when a panel's menu item has been selected by the user.

OnMenuOpened(Int32, IMenu) OnMenuOpened(Int32, IMenu)

Called when a panel's menu is opened by the user.

OnOptionsItemSelected(IMenuItem) OnOptionsItemSelected(IMenuItem)
OnOptionsMenuClosed(IMenu) OnOptionsMenuClosed(IMenu)
OnPanelClosed(Int32, IMenu) OnPanelClosed(Int32, IMenu)

Called when a panel is being closed.

OnPrepareOptionsMenu(IMenu) OnPrepareOptionsMenu(IMenu)

It is usually safe to proxy this call to the owner activity's OnPrepareOptionsMenu(IMenu) if the client desires the same menu for this Dialog.

OnPreparePanel(Int32, View, IMenu) OnPreparePanel(Int32, View, IMenu)

Prepare a panel to be displayed.

OnRestoreInstanceState(Bundle) OnRestoreInstanceState(Bundle)

Restore the state of the dialog from a previously saved bundle.

OnSaveInstanceState() OnSaveInstanceState()

Saves the state of the dialog into a bundle.

OnSearchRequested() OnSearchRequested()

This hook is called when the user signals the desire to start a search.

OnSearchRequested(SearchEvent) OnSearchRequested(SearchEvent)
OnStart() OnStart()

Called when the dialog is starting.

OnStop() OnStop()

Called to tell you that you're stopping.

OnTouchEvent(MotionEvent) OnTouchEvent(MotionEvent)

Called when a touch screen event was not handled by any of the views under it.

OnTrackballEvent(MotionEvent) OnTrackballEvent(MotionEvent)

Called when the trackball was moved and not handled by any of the views inside of the activity.

OnWindowAttributesChanged(WindowManagerLayoutParams) OnWindowAttributesChanged(WindowManagerLayoutParams)

This is called whenever the current window attributes change.

OnWindowFocusChanged(Boolean) OnWindowFocusChanged(Boolean)

This hook is called whenever the window focus changes.

OnWindowStartingActionMode(ActionMode+ICallback) OnWindowStartingActionMode(ActionMode+ICallback)

Called when an action mode is being started for this window.

OnWindowStartingActionMode(ActionMode+ICallback, ActionModeType) OnWindowStartingActionMode(ActionMode+ICallback, ActionModeType)
OpenContextMenu(View) OpenContextMenu(View)
OpenOptionsMenu() OpenOptionsMenu()
RegisterForContextMenu(View) RegisterForContextMenu(View)
RequestWindowFeature(Int32) RequestWindowFeature(Int32)

Enable extended window features.

SetCancelable(Boolean) SetCancelable(Boolean)

Sets whether this dialog is cancelable with the Back key.

SetCanceledOnTouchOutside(Boolean) SetCanceledOnTouchOutside(Boolean)

Sets whether this dialog is canceled when touched outside the window's bounds.

SetCancelMessage(Message) SetCancelMessage(Message)

Set a message to be sent when the dialog is canceled.

SetContentView(Int32) SetContentView(Int32)

Set the screen content from a layout resource.

SetContentView(View) SetContentView(View)

Set the screen content to an explicit view.

SetContentView(View, ViewGroup+LayoutParams) SetContentView(View, ViewGroup+LayoutParams)

Set the screen content to an explicit view.

SetDismissMessage(Message) SetDismissMessage(Message)

Set a message to be sent when the dialog is dismissed.

SetFeatureDrawable(Int32, Drawable) SetFeatureDrawable(Int32, Drawable)

Convenience for calling SetFeatureDrawable(WindowFeatures, Drawable).

SetFeatureDrawableAlpha(Int32, Int32) SetFeatureDrawableAlpha(Int32, Int32)

Convenience for calling SetFeatureDrawableAlpha(WindowFeatures, Int32).

SetFeatureDrawableResource(Int32, Int32) SetFeatureDrawableResource(Int32, Int32)

Convenience for calling SetFeatureDrawableResource(WindowFeatures, Int32).

SetFeatureDrawableUri(Int32, Uri) SetFeatureDrawableUri(Int32, Uri)

Convenience for calling SetFeatureDrawableUri(WindowFeatures, Uri).

SetHandle(IntPtr, JniHandleOwnership) SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
SetOnCancelListener(IDialogInterfaceOnCancelListener) SetOnCancelListener(IDialogInterfaceOnCancelListener)

Set a listener to be invoked when the dialog is canceled.

SetOnDismissListener(IDialogInterfaceOnDismissListener) SetOnDismissListener(IDialogInterfaceOnDismissListener)

Set a listener to be invoked when the dialog is dismissed.

SetOnKeyListener(IDialogInterfaceOnKeyListener) SetOnKeyListener(IDialogInterfaceOnKeyListener)

Sets the callback that will be called if a key is dispatched to the dialog.

SetOnShowListener(IDialogInterfaceOnShowListener) SetOnShowListener(IDialogInterfaceOnShowListener)

Sets a listener to be invoked when the dialog is shown.

SetTitle(ICharSequence) SetTitle(ICharSequence)

Set the title text for this dialog's window.

SetTitle(Int32) SetTitle(Int32)

Set the title text for this dialog's window.

SetTitle(String) SetTitle(String)
Show() Show()

Start the dialog and display it on screen.

TakeKeyEvents(Boolean) TakeKeyEvents(Boolean)

Request that key events come to this dialog.

ToArray<T>() ToArray<T>() Inherited from Object
ToString() ToString()

Returns a string containing a concise, human-readable description of this object.

(Inherited from Object)
UnregisterForContextMenu(View) UnregisterForContextMenu(View)
UnregisterFromRuntime() UnregisterFromRuntime() Inherited from Object
Wait() Wait()

Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object.

(Inherited from Object)
Wait(Int64) Wait(Int64)

Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the specified timeout expires.

(Inherited from Object)
Wait(Int64, Int32) Wait(Int64, Int32)

Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the specified timeout expires.

(Inherited from Object)

Events

CancelEvent CancelEvent
DismissEvent DismissEvent
KeyPress KeyPress
ShowEvent ShowEvent

Explicit Interface Implementations

IJavaObjectEx.ToLocalJniHandle() IJavaObjectEx.ToLocalJniHandle() Inherited from Object
IJavaPeerable.Disposed() IJavaPeerable.Disposed() Inherited from Object
IJavaPeerable.DisposeUnlessReferenced() IJavaPeerable.DisposeUnlessReferenced() Inherited from Object
IJavaPeerable.Finalized() IJavaPeerable.Finalized() Inherited from Object
IJavaPeerable.SetJniIdentityHashCode(Int32) IJavaPeerable.SetJniIdentityHashCode(Int32) Inherited from Object
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) Inherited from Object
IJavaPeerable.SetPeerReference(JniObjectReference) IJavaPeerable.SetPeerReference(JniObjectReference) Inherited from Object

Extension Methods

JavaCast<TResult>(IJavaObject) JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject) JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable) GetJniTypeName(IJavaPeerable)

Applies to