AlertDialog Class
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
A subclass of Dialog that can display one, two or three buttons.
[Android.Runtime.Register("android/app/AlertDialog", DoNotGenerateAcw=true)]
public class AlertDialog : Android.App.Dialog, IDisposable, Java.Interop.IJavaPeerable
[<Android.Runtime.Register("android/app/AlertDialog", DoNotGenerateAcw=true)>]
type AlertDialog = class
inherit Dialog
interface IDialogInterface
interface IJavaObject
interface IDisposable
interface IJavaPeerable
- Inheritance
- Derived
- Attributes
- Implements
A subclass of Dialog that can display one, two or three buttons. If you only want to display a String in this dialog box, use the setMessage() method. If you want to display a more complex view, look up the FrameLayout called "custom" and add your view to it:
FrameLayout fl = findViewById(android.R.id.custom);
fl.addView(myView, new LayoutParams(MATCH_PARENT, WRAP_CONTENT));
The AlertDialog class takes care of automatically setting android.view.WindowManager.LayoutParams#FLAG_ALT_FOCUSABLE_IM WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM
for you based on whether any views in the dialog return true from View#onCheckIsTextEditor() View.onCheckIsTextEditor()
. Generally you want this set for a Dialog without text editors, so that it will be placed on top of the current input method UI. You can modify this behavior by forcing the flag to your desired mode after calling #onCreate
.
<div class="special reference"> <h3>Developer Guides</h3>
For more information about creating dialogs, read the Dialogs developer guide.
</div>
Java documentation for android.app.AlertDialog
.
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.
Alert |
|
Alert |
Creates an alert dialog that uses the default alert dialog theme. |
Alert |
Creates an alert dialog that uses an explicit theme resource. |
Alert |
Creates an alert dialog that uses the default alert dialog theme. |
Alert |
A constructor used when creating managed representations of JNI objects; called by the runtime. |
Theme |
Special theme constant for |
Theme |
Special theme constant for |
Theme |
Special theme constant for |
Theme |
Special theme constant for |
Theme |
Special theme constant for |
Action |
Retrieve the |
Class |
Returns the runtime class of this |
Context |
Retrieve the Context this Dialog is running in. (Inherited from Dialog) |
Current |
Call |
Handle |
The handle to the underlying Android instance. (Inherited from Object) |
Is |
(Inherited from Dialog) |
Jni |
(Inherited from Object) |
Jni |
|
Layout |
(Inherited from Dialog) |
List |
Gets the list view used in the dialog. |
On |
Returns the |
Owner |
Returns the Activity that owns this Dialog. -or- Sets the Activity that owns this dialog. (Inherited from Dialog) |
Peer |
(Inherited from Object) |
Search |
During the onSearchRequested() callbacks, this function will return the
|
Threshold |
This API supports the Mono for Android infrastructure and is not intended to be used directly from your code. |
Threshold |
This API supports the Mono for Android infrastructure and is not intended to be used directly from your code. |
Volume |
By default, this will use the owner Activity's suggested stream type. (Inherited from Dialog) |
Window |
Retrieve the current Window for the activity. (Inherited from Dialog) |
Add |
Add an additional content view to the screen. (Inherited from Dialog) |
Cancel() |
Cancel the dialog. (Inherited from Dialog) |
Clone() |
Creates and returns a copy of this object. (Inherited from Object) |
Close |
(Inherited from Dialog) |
Create() |
Forces immediate creation of the dialog. (Inherited from Dialog) |
Dismiss() |
Dismiss this dialog, removing it from the screen. (Inherited from Dialog) |
Dispatch |
Called to process generic motion events. (Inherited from Dialog) |
Dispatch |
Called to process key events. (Inherited from Dialog) |
Dispatch |
Called to process a key shortcut event. (Inherited from Dialog) |
Dispatch |
Called to process population of AccessibilityEvents. (Inherited from Dialog) |
Dispatch |
Called to process touch screen events. (Inherited from Dialog) |
Dispatch |
Called to process trackball events. (Inherited from Dialog) |
Dispose() | (Inherited from Object) |
Dispose(Boolean) | (Inherited from Object) |
Equals(Object) |
Indicates whether some other object is "equal to" this one. (Inherited from Object) |
Find |
Finds the first descendant view with the given ID or |
Find |
(Inherited from Dialog) |
Get |
Gets one of the buttons used in the dialog. |
Get |
Returns a hash code value for the object. (Inherited from Object) |
Hide() |
Hide the dialog, but do not dismiss it. (Inherited from Dialog) |
Invalidate |
(Inherited from Dialog) |
Java |
Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. (Inherited from Object) |
Notify() |
Wakes up a single thread that is waiting on this object's monitor. (Inherited from Object) |
Notify |
Wakes up all threads that are waiting on this object's monitor. (Inherited from Object) |
On |
To be added
(Inherited from Dialog)
|
On |
To be added
(Inherited from Dialog)
|
On |
Called when the window has been attached to the window manager. (Inherited from Dialog) |
On |
Called when the dialog has detected the user's press of the back key. (Inherited from Dialog) |
On |
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)). (Inherited from Dialog) |
On |
(Inherited from Dialog) |
On |
(Inherited from Dialog) |
On |
Similar to |
On |
Called when the context menu for this view is being built. (Inherited from Dialog) |
On |
It is usually safe to proxy this call to the owner activity's
|
On |
Initialize the contents of the menu for panel 'featureId'. (Inherited from Dialog) |
On |
Instantiate the view to display in the panel for 'featureId'. (Inherited from Dialog) |
On |
Called when the window has been attached to the window manager. (Inherited from Dialog) |
On |
Called when a generic motion event was not handled by any of the views inside of the dialog. (Inherited from Dialog) |
On |
A key was pressed down. (Inherited from Dialog) |
On |
Default implementation of |
On |
Default implementation of |
On |
Called when a key shortcut event is not handled by any of the views in the Dialog. (Inherited from Dialog) |
On |
A key was released. (Inherited from Dialog) |
On |
Called when a panel's menu item has been selected by the user. (Inherited from Dialog) |
On |
Called when a panel's menu is opened by the user. (Inherited from Dialog) |
On |
(Inherited from Dialog) |
On |
(Inherited from Dialog) |
On |
Called when a panel is being closed. (Inherited from Dialog) |
On |
It is usually safe to proxy this call to the owner activity's
|
On |
Prepare a panel to be displayed. (Inherited from Dialog) |
On |
Restore the state of the dialog from a previously saved bundle. (Inherited from Dialog) |
On |
Saves the state of the dialog into a bundle. (Inherited from Dialog) |
On |
This hook is called when the user signals the desire to start a search. (Inherited from Dialog) |
On |
This hook is called when the user signals the desire to start a search. (Inherited from Dialog) |
On |
Called when the dialog is starting. (Inherited from Dialog) |
On |
Called to tell you that you're stopping. (Inherited from Dialog) |
On |
Called when a touch screen event was not handled by any of the views under it. (Inherited from Dialog) |
On |
Called when the trackball was moved and not handled by any of the views inside of the activity. (Inherited from Dialog) |
On |
This is called whenever the current window attributes change. (Inherited from Dialog) |
On |
This hook is called whenever the window focus changes. (Inherited from Dialog) |
On |
(Inherited from Dialog) |
On |
Called when an action mode is being started for this window. (Inherited from Dialog) |
Open |
(Inherited from Dialog) |
Open |
(Inherited from Dialog) |
Register |
(Inherited from Dialog) |
Request |
Enable extended window features. (Inherited from Dialog) |
Require |
Finds the first descendant view with the given ID or throws an IllegalArgumentException if
the ID is invalid (< 0), there is no matching view in the hierarchy, or the dialog has not
yet been fully created (for example, via |
Set |
|
Set |
Obsolete.
Set a listener to be invoked when the specified button of the dialog is pressed. |
Set |
Obsolete.
This member is deprecated. |
Set |
|
Set |
Set a listener to be invoked when the specified button of the dialog is pressed. |
Set |
Set a message to be sent when a button is pressed. |
Set |
|
Set |
Set a listener to be invoked when the specified button of the dialog is pressed. |
Set |
Set a message to be sent when a button is pressed. |
Set |
|
Set |
Obsolete.
Set a listener to be invoked when the specified button of the dialog is pressed. |
Set |
Obsolete.
This member is deprecated. |
Set |
|
Set |
Obsolete.
Set a listener to be invoked when button 2 of the dialog is pressed. |
Set |
Obsolete.
This member is deprecated. |
Set |
|
Set |
Obsolete.
Set a listener to be invoked when button 2 of the dialog is pressed. |
Set |
Obsolete.
This member is deprecated. |
Set |
|
Set |
Obsolete.
Set a listener to be invoked when button 3 of the dialog is pressed. |
Set |
Obsolete.
This member is deprecated. |
Set |
|
Set |
Obsolete.
Set a listener to be invoked when button 3 of the dialog is pressed. |
Set |
Obsolete.
This member is deprecated. |
Set |
Sets whether this dialog is cancelable with the
|
Set |
Sets whether this dialog is canceled when touched outside the window's bounds. (Inherited from Dialog) |
Set |
Set a message to be sent when the dialog is canceled. (Inherited from Dialog) |
Set |
Set the screen content from a layout resource. (Inherited from Dialog) |
Set |
Set the screen content from a layout resource. (Inherited from Dialog) |
Set |
Set the screen content to an explicit view. (Inherited from Dialog) |
Set |
|
Set |
Set a message to be sent when the dialog is dismissed. (Inherited from Dialog) |
Set |
Convenience for calling
|
Set |
Convenience for calling
|
Set |
Convenience for calling
|
Set |
Convenience for calling
|
Set |
Sets the Handle property. (Inherited from Object) |
Set |
Set resId to 0 if you don't want an icon. |
Set |
Set resId to 0 if you don't want an icon. |
Set |
Set an icon as supplied by a theme attribute. |
Set |
|
Set |
|
Set |
|
Set |
Set a listener to be invoked when the dialog is canceled. (Inherited from Dialog) |
Set |
Set a listener to be invoked when the dialog is dismissed. (Inherited from Dialog) |
Set |
Sets the callback that will be called if a key is dispatched to the dialog. (Inherited from Dialog) |
Set |
Sets a listener to be invoked when the dialog is shown. (Inherited from Dialog) |
Set |
Set the title text for this dialog's window. (Inherited from Dialog) |
Set |
Set the title text for this dialog's window. (Inherited from Dialog) |
Set |
Set the title text for this dialog's window. (Inherited from Dialog) |
Set |
Set the view to display in that dialog, specifying the spacing to appear around that view. |
Set |
Set the view to display in that dialog. |
Show() |
Start the dialog and display it on screen. (Inherited from Dialog) |
Take |
Request that key events come to this dialog. (Inherited from Dialog) |
To |
(Inherited from Object) |
To |
Returns a string representation of the object. (Inherited from Object) |
Unregister |
(Inherited from Dialog) |
Unregister |
(Inherited from Object) |
Wait() |
Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>. (Inherited from Object) |
Wait(Int64, Int32) |
Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed. (Inherited from Object) |
Wait(Int64) |
Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed. (Inherited from Object) |
Cancel |
(Inherited from Dialog) |
Dismiss |
(Inherited from Dialog) |
Key |
(Inherited from Dialog) |
Show |
(Inherited from Dialog) |
IJava |
(Inherited from Object) |
IJava |
(Inherited from Object) |
IJava |
(Inherited from Object) |
IJava |
(Inherited from Object) |
IJava |
(Inherited from Object) |
IJava |
(Inherited from Object) |
IJava |
(Inherited from Object) |
Java |
Performs an Android runtime-checked type conversion. |
Java |
|
Get |