Android APIs
public class

AppCompatDialog

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

Class Overview

Base class for AppCompat themed Dialogs.

Summary

[Expand]
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.
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(int layoutResID)
Set the screen content from a layout resource.
void setContentView(View view)
Set the screen content to an explicit view.
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.
[Expand]
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

public AppCompatDialog (Context context)

public AppCompatDialog (Context context, int theme)

Protected Constructors

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

Public Methods

public 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 The desired content to display.
params Layout parameters for the view.

public AppCompatDelegate getDelegate ()

Returns

public ActionBar getSupportActionBar ()

Support library version of getActionBar().

Retrieve a reference to this dialog's ActionBar.

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

public void onSupportActionModeFinished (ActionMode mode)

Called when a support action mode has finished.

Parameters
mode The action mode that just finished.

public void onSupportActionModeStarted (ActionMode mode)

Called when a support action mode has been started.

Parameters
mode The new action mode.

public 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 Callback to control the lifecycle of this action mode
Returns
  • The ActionMode that was started, or null if the system should present it

public 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 Resource ID to be inflated.

public 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 The desired content to display.

public 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 hierarhcy.

Parameters
view The desired content to display.
params Layout parameters for the view.

public void setTitle (CharSequence title)

Set the title text for this dialog's window.

Parameters
title The new text to display in the title.

public 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 the title's text resource identifier

public boolean supportRequestWindowFeature (int featureId)

Enable extended support library window features.

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

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

Protected Methods

protected void onCreate (Bundle savedInstanceState)

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

Parameters
savedInstanceState If this dialog is being reinitalized 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.

protected void onStop ()

Called to tell you that you're stopping.