Skip to content

Most visited

Recently visited

navigation

AppCompatDialog

public class AppCompatDialog
extends Dialog implements AppCompatCallback

java.lang.Object
   ↳ android.app.Dialog
     ↳ android.support.v7.app.AppCompatDialog
Known Direct Subclasses
Known Indirect Subclasses


Base class for AppCompat themed Dialogs.

Summary

Inherited constants

From interface android.content.DialogInterface

Public constructors

AppCompatDialog(Context context)
AppCompatDialog(Context context, int theme)

Protected constructors

AppCompatDialog(Context context, boolean cancelable, DialogInterface.OnCancelListener cancelListener)

Public methods

void addContentView(View view, ViewGroup.LayoutParams params)

Add an additional content view to the screen.

View findViewById(int id)

Finds a child view with the given identifier.

AppCompatDelegate getDelegate()
ActionBar getSupportActionBar()

Support library version of getActionBar().

void onSupportActionModeFinished(ActionMode mode)

Called when a support action mode has finished.

void onSupportActionModeStarted(ActionMode mode)

Called when a support action mode has been started.

ActionMode onWindowStartingSupportActionMode(ActionMode.Callback callback)

Called when a support action mode is being started for this window.

void setContentView(View view)

Set the screen content to an explicit view.

void setContentView(int layoutResID)

Set the screen content from a layout resource.

void setContentView(View view, ViewGroup.LayoutParams params)

Set the screen content to an explicit view.

void setTitle(CharSequence title)

Set the title text for this dialog's window.

void setTitle(int titleId)

Set the title text for this dialog's window.

boolean supportRequestWindowFeature(int featureId)

Enable extended support library window features.

Protected methods

void onCreate(Bundle savedInstanceState)

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

void onStop()

Called to tell you that you're stopping.

Inherited methods

From class android.app.Dialog
From class java.lang.Object
From interface android.content.DialogInterface
From interface android.view.Window.Callback
From interface android.view.KeyEvent.Callback
From interface android.view.View.OnCreateContextMenuListener
From interface android.support.v7.app.AppCompatCallback

Public constructors

AppCompatDialog

AppCompatDialog (Context context)

Parameters
context Context

AppCompatDialog

AppCompatDialog (Context context, 
                int theme)

Parameters
context Context
theme int

Protected constructors

AppCompatDialog

AppCompatDialog (Context context, 
                boolean cancelable, 
                DialogInterface.OnCancelListener cancelListener)

Parameters
context Context
cancelable boolean
cancelListener DialogInterface.OnCancelListener

Public methods

addContentView

void addContentView (View view, 
                ViewGroup.LayoutParams params)

Add an additional content view to the screen. Added after any existing ones in the screen -- existing views are NOT removed.

Parameters
view View: The desired content to display.
params ViewGroup.LayoutParams: Layout parameters for the view.

findViewById

View findViewById (int id)

Finds a child view with the given identifier. Returns null if the specified child view does not exist or the dialog has not yet been fully created (for example, via show() or create()).

Parameters
id int: the identifier of the view to find
Returns
View The view with the given id or null.

getDelegate

AppCompatDelegate getDelegate ()

Returns
AppCompatDelegate The AppCompatDelegate being used by this Dialog.

getSupportActionBar

ActionBar getSupportActionBar ()

Support library version of getActionBar().

Retrieve a reference to this dialog's ActionBar.

Returns
ActionBar The Dialog's ActionBar, or null if it does not have one.

onSupportActionModeFinished

void onSupportActionModeFinished (ActionMode mode)

Called when a support action mode has finished.

Parameters
mode ActionMode: The action mode that just finished.

onSupportActionModeStarted

void onSupportActionModeStarted (ActionMode mode)

Called when a support action mode has been started.

Parameters
mode ActionMode: The new action mode.

onWindowStartingSupportActionMode

ActionMode onWindowStartingSupportActionMode (ActionMode.Callback callback)

Called when a support action mode is being started for this window. Gives the callback an opportunity to handle the action mode in its own unique and beautiful way. If this method returns null the system can choose a way to present the mode or choose not to start the mode at all.

Parameters
callback ActionMode.Callback: Callback to control the lifecycle of this action mode
Returns
ActionMode The ActionMode that was started, or null if the system should present it

setContentView

void setContentView (View view)

Set the screen content to an explicit view. This view is placed directly into the screen's view hierarchy. It can itself be a complex view hierarchy.

Parameters
view View: The desired content to display.

setContentView

void setContentView (int layoutResID)

Set the screen content from a layout resource. The resource will be inflated, adding all top-level views to the screen.

Parameters
layoutResID int: Resource ID to be inflated.

setContentView

void setContentView (View view, 
                ViewGroup.LayoutParams params)

Set the screen content to an explicit view. This view is placed directly into the screen's view hierarchy. It can itself be a complex view hierarchy.

Parameters
view View: The desired content to display.
params ViewGroup.LayoutParams: Layout parameters for the view.

setTitle

void setTitle (CharSequence title)

Set the title text for this dialog's window.

Parameters
title CharSequence: The new text to display in the title.

setTitle

void setTitle (int titleId)

Set the title text for this dialog's window. The text is retrieved from the resources with the supplied identifier.

Parameters
titleId int: the title's text resource identifier

supportRequestWindowFeature

boolean supportRequestWindowFeature (int featureId)

Enable extended support library window features.

This is a convenience for calling getWindow().requestFeature().

Parameters
featureId int: The desired feature as defined in Window or WindowCompat.
Returns
boolean Returns true if the requested feature is supported and now enabled.

See also:

Protected methods

onCreate

void onCreate (Bundle savedInstanceState)

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

Parameters
savedInstanceState Bundle: If this dialog is being reinitialized after a the hosting activity was previously shut down, holds the result from the most recent call to onSaveInstanceState(), or null if this is the first time.

onStop

void onStop ()

Called to tell you that you're stopping.

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

Hooray!

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 one-minute survey?
Help us improve Android tools and documentation.