Skip to content

Most visited

Recently visited

navigation

DialogInterface

public interface DialogInterface

android.content.DialogInterface
Known Indirect Subclasses


Interface that defines a dialog-type class that can be shown, dismissed, or canceled, and may have buttons that can be clicked.

Summary

Nested classes

interface DialogInterface.OnCancelListener

Interface used to allow the creator of a dialog to run some code when the dialog is canceled. 

interface DialogInterface.OnClickListener

Interface used to allow the creator of a dialog to run some code when an item on the dialog is clicked. 

interface DialogInterface.OnDismissListener

Interface used to allow the creator of a dialog to run some code when the dialog is dismissed. 

interface DialogInterface.OnKeyListener

Interface definition for a callback to be invoked when a key event is dispatched to this dialog. 

interface DialogInterface.OnMultiChoiceClickListener

Interface used to allow the creator of a dialog to run some code when an item in a multi-choice dialog is clicked. 

interface DialogInterface.OnShowListener

Interface used to allow the creator of a dialog to run some code when the dialog is shown. 

Constants

int BUTTON1

This constant was deprecated in API level 3. Use BUTTON_POSITIVE

int BUTTON2

This constant was deprecated in API level 3. Use BUTTON_NEGATIVE

int BUTTON3

This constant was deprecated in API level 3. Use BUTTON_NEUTRAL

int BUTTON_NEGATIVE

The identifier for the negative button.

int BUTTON_NEUTRAL

The identifier for the neutral button.

int BUTTON_POSITIVE

The identifier for the positive button.

Public methods

abstract void cancel()

Cancels the dialog, invoking the DialogInterface.OnCancelListener.

abstract void dismiss()

Dismisses the dialog, invoking the DialogInterface.OnDismissListener.

Constants

BUTTON1

added in API level 1
int BUTTON1

This constant was deprecated in API level 3.
Use BUTTON_POSITIVE

Constant Value: -1 (0xffffffff)

BUTTON2

added in API level 1
int BUTTON2

This constant was deprecated in API level 3.
Use BUTTON_NEGATIVE

Constant Value: -2 (0xfffffffe)

BUTTON3

added in API level 1
int BUTTON3

This constant was deprecated in API level 3.
Use BUTTON_NEUTRAL

Constant Value: -3 (0xfffffffd)

BUTTON_NEGATIVE

added in API level 3
int BUTTON_NEGATIVE

The identifier for the negative button.

Constant Value: -2 (0xfffffffe)

BUTTON_NEUTRAL

added in API level 3
int BUTTON_NEUTRAL

The identifier for the neutral button.

Constant Value: -3 (0xfffffffd)

BUTTON_POSITIVE

added in API level 3
int BUTTON_POSITIVE

The identifier for the positive button.

Constant Value: -1 (0xffffffff)

Public methods

cancel

added in API level 1
void cancel ()

Cancels the dialog, invoking the DialogInterface.OnCancelListener.

The DialogInterface.OnDismissListener may also be called if cancellation dismisses the dialog.

dismiss

added in API level 1
void dismiss ()

Dismisses the dialog, invoking the DialogInterface.OnDismissListener.

This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields

Hooray!

Follow Google Developers on WeChat

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a short survey?
Help us improve the Android developer experience.
(Sep 2017 survey)