public class ContextThemeWrapper extends ContextWrapper
ACCESSIBILITY_SERVICE, ACCOUNT_SERVICE, ACTIVITY_SERVICE, ALARM_SERVICE, APPWIDGET_SERVICE, AUDIO_SERVICE, BACKUP_SERVICE, BIND_ABOVE_CLIENT, BIND_ADJUST_WITH_ACTIVITY, BIND_ALLOW_OOM_MANAGEMENT, BIND_AUTO_CREATE, BIND_DEBUG_UNBIND, BIND_IMPORTANT, BIND_NOT_FOREGROUND, BIND_NOT_VISIBLE, BIND_VISIBLE, BIND_WAIVE_PRIORITY, BLUETOOTH_SERVICE, CLIPBOARD_SERVICE, CONNECTIVITY_SERVICE, CONTEXT_IGNORE_SECURITY, CONTEXT_INCLUDE_CODE, CONTEXT_RESTRICTED, COUNTRY_DETECTOR, DEVICE_POLICY_SERVICE, DISPLAY_SERVICE, DOWNLOAD_SERVICE, DROPBOX_SERVICE, INPUT_METHOD_SERVICE, INPUT_SERVICE, KEYGUARD_SERVICE, LAYOUT_INFLATER_SERVICE, LOCATION_SERVICE, MEDIA_ROUTER_SERVICE, MODE_APPEND, MODE_ENABLE_WRITE_AHEAD_LOGGING, MODE_MULTI_PROCESS, MODE_PRIVATE, MODE_WORLD_READABLE, MODE_WORLD_WRITEABLE, NETWORK_POLICY_SERVICE, NETWORK_STATS_SERVICE, NETWORKMANAGEMENT_SERVICE, NFC_SERVICE, NOTIFICATION_SERVICE, NSD_SERVICE, POWER_SERVICE, SCHEDULING_POLICY_SERVICE, SEARCH_SERVICE, SENSOR_SERVICE, SERIAL_SERVICE, SIP_SERVICE, STATUS_BAR_SERVICE, STORAGE_SERVICE, TELEPHONY_SERVICE, TEXT_SERVICES_MANAGER_SERVICE, THROTTLE_SERVICE, UI_MODE_SERVICE, UPDATE_LOCK_SERVICE, USB_SERVICE, USER_SERVICE, VIBRATOR_SERVICE, WALLPAPER_SERVICE, WIFI_P2P_SERVICE, WIFI_SERVICE, WINDOW_SERVICE
Constructor and Description |
---|
ContextThemeWrapper() |
ContextThemeWrapper(Context base,
int themeres) |
Modifier and Type | Method and Description |
---|---|
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.
|
protected void |
attachBaseContext(Context newBase)
Set the base context for this ContextWrapper.
|
Resources |
getResources()
Return a Resources instance for your application's package.
|
Object |
getSystemService(String name)
Return the handle to a system-level service by name.
|
Resources.Theme |
getTheme()
Return the Theme object associated with this Context.
|
int |
getThemeResId() |
protected 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. |
void |
setTheme(int resid)
Set the base theme for this context.
|
bindService, bindService, checkCallingOrSelfPermission, checkCallingOrSelfUriPermission, checkCallingPermission, checkCallingUriPermission, checkPermission, checkUriPermission, checkUriPermission, clearWallpaper, createConfigurationContext, createDisplayContext, createPackageContext, createPackageContextAsUser, databaseList, deleteDatabase, deleteFile, enforceCallingOrSelfPermission, enforceCallingOrSelfUriPermission, enforceCallingPermission, enforceCallingUriPermission, enforcePermission, enforceUriPermission, enforceUriPermission, fileList, getApplicationContext, getApplicationInfo, getAssets, getBaseContext, getCacheDir, getClassLoader, getCompatibilityInfo, getContentResolver, getDatabasePath, getDir, getExternalCacheDir, getExternalFilesDir, getFilesDir, getFileStreamPath, getMainLooper, getObbDir, getPackageCodePath, getPackageManager, getPackageName, getPackageResourcePath, getSharedPreferences, getSharedPrefsFile, getWallpaper, getWallpaperDesiredMinimumHeight, getWallpaperDesiredMinimumWidth, grantUriPermission, isRestricted, openFileInput, openFileOutput, openOrCreateDatabase, openOrCreateDatabase, peekWallpaper, registerReceiver, registerReceiver, registerReceiverAsUser, removeStickyBroadcast, removeStickyBroadcastAsUser, revokeUriPermission, sendBroadcast, sendBroadcast, sendBroadcastAsUser, sendBroadcastAsUser, sendOrderedBroadcast, sendOrderedBroadcast, sendOrderedBroadcastAsUser, sendStickyBroadcast, sendStickyBroadcastAsUser, sendStickyOrderedBroadcast, sendStickyOrderedBroadcastAsUser, setWallpaper, setWallpaper, startActivities, startActivities, startActivitiesAsUser, startActivity, startActivity, startActivityAsUser, startActivityAsUser, startInstrumentation, startIntentSender, startIntentSender, startService, startServiceAsUser, stopService, stopServiceAsUser, unbindService, unregisterReceiver
getString, getString, getText, obtainStyledAttributes, obtainStyledAttributes, obtainStyledAttributes, obtainStyledAttributes, registerComponentCallbacks, unregisterComponentCallbacks
public ContextThemeWrapper()
public ContextThemeWrapper(Context base, int themeres)
protected void attachBaseContext(Context newBase)
ContextWrapper
attachBaseContext
in class ContextWrapper
newBase
- The new base context for this wrapper.public void applyOverrideConfiguration(Configuration overrideConfiguration)
Context.createConfigurationContext(Configuration)
for more
information.
This method can only be called once, and must be called before any
calls to getResources()
are made.
public Resources getResources()
Context
getResources
in class ContextWrapper
public void setTheme(int resid)
Context
Activity.setContentView(int)
or
LayoutInflater.inflate(int, android.view.ViewGroup)
).setTheme
in class ContextWrapper
resid
- The style resource describing the theme.public int getThemeResId()
getThemeResId
in class ContextWrapper
public Resources.Theme getTheme()
Context
getTheme
in class ContextWrapper
public Object getSystemService(String name)
Context
Context.WINDOW_SERVICE
("window")
WindowManager
.
Context.LAYOUT_INFLATER_SERVICE
("layout_inflater")
LayoutInflater
for inflating layout resources
in this context.
Context.ACTIVITY_SERVICE
("activity")
ActivityManager
for interacting with the
global activity state of the system.
Context.POWER_SERVICE
("power")
PowerManager
for controlling power
management.
Context.ALARM_SERVICE
("alarm")
AlarmManager
for receiving intents at the
time of your choosing.
Context.NOTIFICATION_SERVICE
("notification")
NotificationManager
for informing the user
of background events.
Context.KEYGUARD_SERVICE
("keyguard")
KeyguardManager
for controlling keyguard.
Context.LOCATION_SERVICE
("location")
LocationManager
for controlling location
(e.g., GPS) updates.
Context.SEARCH_SERVICE
("search")
SearchManager
for handling search.
Context.VIBRATOR_SERVICE
("vibrator")
Vibrator
for interacting with the vibrator
hardware.
Context.CONNECTIVITY_SERVICE
("connection")
ConnectivityManager
for
handling management of network connections.
Context.WIFI_SERVICE
("wifi")
WifiManager
for management of
Wi-Fi connectivity.
Context.INPUT_METHOD_SERVICE
("input_method")
InputMethodManager
for management of input methods.
Context.UI_MODE_SERVICE
("uimode")
UiModeManager
for controlling UI modes.
Context.DOWNLOAD_SERVICE
("download")
DownloadManager
for requesting HTTP downloads
Note: System services obtained via this API may be closely associated with the Context in which they are obtained from. In general, do not share the service objects between various different contexts (Activities, Applications, Services, Providers, etc.)
getSystemService
in class ContextWrapper
name
- The name of the desired service.Context.WINDOW_SERVICE
,
WindowManager
,
Context.LAYOUT_INFLATER_SERVICE
,
LayoutInflater
,
Context.ACTIVITY_SERVICE
,
ActivityManager
,
Context.POWER_SERVICE
,
PowerManager
,
Context.ALARM_SERVICE
,
AlarmManager
,
Context.NOTIFICATION_SERVICE
,
NotificationManager
,
Context.KEYGUARD_SERVICE
,
KeyguardManager
,
Context.LOCATION_SERVICE
,
LocationManager
,
Context.SEARCH_SERVICE
,
SearchManager
,
Context.SENSOR_SERVICE
,
SensorManager
,
Context.STORAGE_SERVICE
,
StorageManager
,
Context.VIBRATOR_SERVICE
,
Vibrator
,
Context.CONNECTIVITY_SERVICE
,
ConnectivityManager
,
Context.WIFI_SERVICE
,
WifiManager
,
Context.AUDIO_SERVICE
,
AudioManager
,
Context.MEDIA_ROUTER_SERVICE
,
MediaRouter
,
Context.TELEPHONY_SERVICE
,
TelephonyManager
,
Context.INPUT_METHOD_SERVICE
,
InputMethodManager
,
Context.UI_MODE_SERVICE
,
UiModeManager
,
Context.DOWNLOAD_SERVICE
,
DownloadManager
protected void onApplyThemeResource(Resources.Theme theme, int resid, boolean first)
setTheme(int)
and getTheme()
to apply a theme
resource to the current Theme object. Can override to change the
default (simple) behavior. This method will not be called in multiple
threads simultaneously.theme
- The Theme object being modified.resid
- The theme style resource being applied to theme.first
- Set to true if this is the first time a style is being
applied to theme.