Android Guides | Samples

Android.Content.Res.Configuration Class

This class describes all device configuration information that can impact the resources the application retrieves.

See Also: Configuration

Syntax

[Android.Runtime.Register("android/content/res/Configuration", DoNotGenerateAcw=true)]
public sealed class Configuration : Object, IParcelable, IComparable, IDisposable

Remarks

This class describes all device configuration information that can impact the resources the application retrieves. This includes both user-specified configuration options (locale and scaling) as well as device configurations (such as input modes, screen size and screen orientation).

java Example

Configuration config = getResources().getConfiguration();

You can acquire this object from Resources, using Resources.Configuration. Thus, from an activity, you can get it by chaining the request with Android.Views.ContextThemeWrapper.getResources():

[Android Documentation]

Requirements

Namespace: Android.Content.Res
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 1

The members of Android.Content.Res.Configuration are listed below.

See Also: Object

Public Constructors

Construct an invalid Configuration.
Makes a deep copy suitable for modification.

Public Fields

const
DensityDpiUndefinedInt32 (0). Default value for Configuration.DensityDpi indicating that no width has been specified.
const
MncZeroInt32 (65535). Constant used to to represent MNC (Mobile Network Code) zero. 0 cannot be used, since it is used to represent an undefined MNC.
const
ScreenHeightDpUndefinedScreen (0). Default value for Configuration.ScreenHeightDp indicating that no width has been specified.
const
ScreenWidthDpUndefinedScreen (0). Default value for Configuration.ScreenWidthDp indicating that no width has been specified.
const
SmallestScreenWidthDpUndefinedInt32 (0). Default value for Configuration.SmallestScreenWidthDp indicating that no width has been specified.
const
UiModeNightMaskUiMode (48). Constant for Configuration.UiMode: bits that encode the night mode.
const
UiModeNightNoUiMode (16). Constant for Configuration.UiMode: a Configuration.UiModeNightMask value that corresponds to the notnight resource qualifier.
const
UiModeNightUndefinedUiMode (0). Constant for Configuration.UiMode: a Configuration.UiModeNightMask value indicating that no mode type has been set.
const
UiModeNightYesUiMode (32). Constant for Configuration.UiMode: a Configuration.UiModeNightMask value that corresponds to the night resource qualifier.
const
UiModeTypeApplianceUiMode (5). Constant for Configuration.UiMode: a Configuration.UiModeTypeMask value that corresponds to the appliance resource qualifier.
const
UiModeTypeCarUiMode (3). Constant for Configuration.UiMode: a Configuration.UiModeTypeMask value that corresponds to the car resource qualifier.
const
UiModeTypeDeskUiMode (2). Constant for Configuration.UiMode: a Configuration.UiModeTypeMask value that corresponds to the desk resource qualifier.
const
UiModeTypeMaskUiMode (15). Constant for Configuration.UiMode: bits that encode the mode type.
const
UiModeTypeNormalUiMode (1). Constant for Configuration.UiMode: a Configuration.UiModeTypeMask value that corresponds to no UI mode resource qualifier specified.
const
UiModeTypeTelevisionUiMode (4). Constant for Configuration.UiMode: a Configuration.UiModeTypeMask value that corresponds to the television resource qualifier.
const
UiModeTypeUndefinedUiMode (0). Constant for Configuration.UiMode: a Configuration.UiModeTypeMask value indicating that no mode type has been set.
const
UiModeTypeWatchUiMode (6). Constant for Configuration.UiMode: a Configuration.UiModeTypeMask value that corresponds to the watch resource qualifier.

Public Properties

[read-only]
static
CreatorIParcelableCreator.
DensityDpiInt32. The target screen density being rendered to, corresponding to density resource qualifier.
FontScaleSingle. Current user preference for the scaling factor for fonts, relative to the base density scaling.
HardKeyboardHiddenHardKeyboardHidden. A flag indicating whether the hard keyboard has been hidden.
KeyboardKeyboardType. The kind of keyboard attached to the device.
KeyboardHiddenKeyboardHidden. A flag indicating whether any keyboard is available.
[read-only]
LayoutDirectionLayoutDirection. Return the layout direction.
LocaleLocale. Current user preference for the locale, corresponding to locale resource qualifier.
MccInt32. IMSI MCC (Mobile Country Code), corresponding to mcc resource qualifier. 0 if undefined.
MncInt32. IMSI MNC (Mobile Network Code), corresponding to mnc resource qualifier. 0 if undefined.
NavigationNavigation. The kind of navigation method available on the device.
NavigationHiddenNavigationHidden. A flag indicating whether any 5-way or DPAD navigation available.
OrientationOrientation. Overall orientation of the screen.
ScreenHeightDpInt32. The current height of the available screen space, in dp units, corresponding to screen height resource qualifier.
ScreenLayoutScreenLayout. Bit mask of overall layout of the screen.
ScreenWidthDpInt32. The current width of the available screen space, in dp units, corresponding to screen width resource qualifier.
SmallestScreenWidthDpInt32. The smallest screen size an application will see in normal operation, corresponding to smallest screen width resource qualifier.
TouchscreenTouchScreenType. The kind of touch screen attached to the device.
UiModeUiMode. Bit mask of the ui mode.

Protected Properties

[read-only]
override
ThresholdClassIntPtr. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.
[read-only]
override
ThresholdTypeType. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Public Methods

CompareTo(Configuration) : Int32
DescribeContents() : Int32
Parcelable methods
Diff(Configuration) : ConfigChanges
Return a bit mask of the differences between this Configuration object and the given one.
Equals(Configuration) : Boolean
IsLayoutSizeAtLeast(Int32) : Boolean
Check if the Configuration's current Configuration.ScreenLayout is at least the given size.
static
NeedNewResources(ConfigChanges, ConfigChanges) : Boolean
Determine if a new resource needs to be loaded from the bit set of configuration changes returned by Configuration.UpdateFrom(Configuration).
ReadFromParcel(Parcel)
SetLayoutDirection(Locale)
Set the layout direction from the Locale.
SetLocale(Locale)
Set the locale.
SetTo(Configuration)
SetToDefaults()
Set this object to the system defaults.
UpdateFrom(Configuration) : ConfigChanges
Copy the fields from delta into this Configuration object, keeping track of which ones have changed.
WriteToParcel(Parcel, ParcelableWriteFlags)
Flatten this object in to a Parcel.

Explicitly Implemented Interface Members