added in version 27.1.0
belongs to Maven artifact


public class ContextThemeWrapper
extends ContextWrapper

   ↳ android.content.Context
     ↳ android.content.ContextWrapper

A context wrapper that allows you to modify or replace the theme of the wrapped context.


Inherited constants

From class android.content.Context

Public constructors


Creates a new context wrapper with no theme and no base context.

ContextThemeWrapper(Context base, int themeResId)

Creates a new context wrapper with the specified theme.

ContextThemeWrapper(Context base, Resources.Theme theme)

Creates a new context wrapper with the specified theme.

Public methods

void applyOverrideConfiguration(Configuration overrideConfiguration)

Call to set an "override configuration" on this context -- this is a configuration that replies one or more values of the standard configuration that is applied to the context.

AssetManager getAssets()
Resources getResources()
Object getSystemService(String name)
Resources.Theme getTheme()
int getThemeResId()

Returns the resource ID of the theme that is to be applied on top of the base context's theme.

void setTheme(int resid)

Protected methods

void attachBaseContext(Context newBase)
void onApplyThemeResource(Resources.Theme theme, int resid, boolean first)

Called by setTheme(int) and getTheme() to apply a theme resource to the current Theme object.

Inherited methods

From class android.content.ContextWrapper