Build 1.0_r1(from source)

android.view
Class ContextThemeWrapper

java.lang.Object
  extended by android.content.Context
      extended by android.content.ContextWrapper
          extended by android.view.ContextThemeWrapper
Direct Known Subclasses:
Activity

public class ContextThemeWrapper
extends ContextWrapper

A ContextWrapper that allows you to modify the theme from what is in the wrapped context.


Field Summary
 
Fields inherited from class android.content.Context
ACTIVITY_SERVICE, ALARM_SERVICE, AUDIO_SERVICE, BIND_AUTO_CREATE, BIND_DEBUG_UNBIND, BLUETOOTH_SERVICE, CLIPBOARD_SERVICE, CONNECTIVITY_SERVICE, CONTEXT_IGNORE_SECURITY, CONTEXT_INCLUDE_CODE, KEYGUARD_SERVICE, LAYOUT_INFLATER_SERVICE, LOCATION_SERVICE, MODE_APPEND, MODE_PRIVATE, MODE_WORLD_READABLE, MODE_WORLD_WRITEABLE, NOTIFICATION_SERVICE, POWER_SERVICE, SEARCH_SERVICE, SENSOR_SERVICE, STATUS_BAR_SERVICE, TELEPHONY_SERVICE, VIBRATOR_SERVICE, WALLPAPER_SERVICE, WIFI_SERVICE, WINDOW_SERVICE
 
Constructor Summary
ContextThemeWrapper()
           
ContextThemeWrapper(Context base, int themeres)
           
 
Method Summary
protected  void attachBaseContext(Context newBase)
          Set the base context for this ContextWrapper.
 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.
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.
 
Methods inherited from class android.content.ContextWrapper
bindService, checkCallingOrSelfPermission, checkCallingOrSelfUriPermission, checkCallingPermission, checkCallingUriPermission, checkPermission, checkUriPermission, checkUriPermission, clearWallpaper, createPackageContext, databaseList, deleteDatabase, deleteFile, enforceCallingOrSelfPermission, enforceCallingOrSelfUriPermission, enforceCallingPermission, enforceCallingUriPermission, enforcePermission, enforceUriPermission, enforceUriPermission, fileList, getApplicationContext, getAssets, getBaseContext, getCacheDir, getClassLoader, getContentResolver, getDatabasePath, getDir, getFilesDir, getFileStreamPath, getMainLooper, getPackageCodePath, getPackageManager, getPackageName, getPackageResourcePath, getResources, getSharedPreferences, getWallpaper, getWallpaperDesiredMinimumHeight, getWallpaperDesiredMinimumWidth, grantUriPermission, openFileInput, openFileOutput, openOrCreateDatabase, peekWallpaper, registerReceiver, registerReceiver, removeStickyBroadcast, revokeUriPermission, sendBroadcast, sendBroadcast, sendOrderedBroadcast, sendOrderedBroadcast, sendStickyBroadcast, setWallpaper, setWallpaper, startActivity, startInstrumentation, startService, stopService, unbindService, unregisterReceiver
 
Methods inherited from class android.content.Context
getString, getString, getText, obtainStyledAttributes, obtainStyledAttributes, obtainStyledAttributes, obtainStyledAttributes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContextThemeWrapper

public ContextThemeWrapper()

ContextThemeWrapper

public ContextThemeWrapper(Context base,
                           int themeres)
Method Detail

attachBaseContext

protected void attachBaseContext(Context newBase)
Description copied from class: ContextWrapper
Set the base context for this ContextWrapper. All calls will then be delegated to the base context. Throws IllegalStateException if a base context has already been set.

Overrides:
attachBaseContext in class ContextWrapper
Parameters:
newBase - The new base context for this wrapper.

setTheme

public void setTheme(int resid)
Description copied from class: Context
Set the base theme for this context. Note that this should be called before any views are instantiated in the Context (for example before calling Activity.setContentView(int) or LayoutInflater.inflate(int, android.view.ViewGroup)).

Overrides:
setTheme in class ContextWrapper
Parameters:
resid - The style resource describing the theme.

getTheme

public Resources.Theme getTheme()
Description copied from class: Context
Return the Theme object associated with this Context.

Overrides:
getTheme in class ContextWrapper

getSystemService

public Object getSystemService(String name)
Description copied from class: Context
Return the handle to a system-level service by name. The class of the returned object varies by the requested name. Currently available names are:
Context.WINDOW_SERVICE ("window")
The top-level window manager in which you can place custom windows. The returned object is a WindowManager.
Context.LAYOUT_INFLATER_SERVICE ("layout_inflater")
A LayoutInflater for inflating layout resources in this context.
Context.ACTIVITY_SERVICE ("activity")
A ActivityManager for interacting with the global activity state of the system.
Context.POWER_SERVICE ("power")
A PowerManager for controlling power management.
Context.ALARM_SERVICE ("alarm")
A AlarmManager for receiving intents at the time of your choosing.
Context.NOTIFICATION_SERVICE ("notification")
A NotificationManager for informing the user of background events.
Context.KEYGUARD_SERVICE ("keyguard")
A KeyguardManager for controlling keyguard.
Context.LOCATION_SERVICE ("location")
A LocationManager for controlling location (e.g., GPS) updates.
Context.SEARCH_SERVICE ("search")
A SearchManager for handling search.
Context.VIBRATOR_SERVICE ("vibrator")
A Vibrator for interacting with the vibrator hardware.
Context.CONNECTIVITY_SERVICE ("connection")
A ConnectivityManager for handling management of network connections.
Context.WIFI_SERVICE ("wifi")
A WifiManager for management of Wi-Fi connectivity.

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.)

Overrides:
getSystemService in class ContextWrapper
Parameters:
name - The name of the desired service.
Returns:
The service or null if the name does not exist.
See Also:
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.VIBRATOR_SERVICE, Vibrator, Context.CONNECTIVITY_SERVICE, ConnectivityManager, Context.WIFI_SERVICE, WifiManager, Context.AUDIO_SERVICE, AudioManager, Context.TELEPHONY_SERVICE, android.internal.TelephonyManager

onApplyThemeResource

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. Can override to change the default (simple) behavior. This method will not be called in multiple threads simultaneously.

Parameters:
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.

Build 1.0_r1(from source)

Please submit a feedback, bug or feature