Configuration Class

Definition

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

[Android.Runtime.Register("android/content/res/Configuration", DoNotGenerateAcw=true)]
public sealed class Configuration : Java.Lang.Object, Android.OS.IParcelable, IDisposable, Java.Interop.IJavaPeerable, Java.Lang.IComparable
[<Android.Runtime.Register("android/content/res/Configuration", DoNotGenerateAcw=true)>]
type Configuration = class
    inherit Object
    interface IParcelable
    interface IJavaObject
    interface IDisposable
    interface IJavaPeerable
    interface IComparable
Inheritance
Configuration
Attributes
Implements

Remarks

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

You can acquire this object from Resources, using Resources#getConfiguration. Thus, from an activity, you can get it by chaining the request with android.app.Activity#getResources:

Configuration config = getResources().getConfiguration();

Java documentation for android.content.res.Configuration.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Constructors

Configuration()

Construct an invalid Configuration.

Configuration(Configuration)

Makes a deep copy suitable for modification.

Fields

ColorModeHdrMask
Obsolete.

Constant for #colorMode: bits that encode the dynamic range of the screen.

ColorModeHdrNo
Obsolete.

Constant for #colorMode: a #COLOR_MODE_HDR_MASK value indicating that the screen is not HDR (low/standard dynamic range).

ColorModeHdrShift
Obsolete.

Constant for #colorMode: bits shift to get the screen dynamic range.

ColorModeHdrUndefined
Obsolete.

Constant for #colorMode: a #COLOR_MODE_HDR_MASK value indicating that it is unknown whether or not the screen is HDR.

ColorModeHdrYes
Obsolete.

Constant for #colorMode: a #COLOR_MODE_HDR_MASK value indicating that the screen is HDR (dynamic range).

ColorModeUndefined
Obsolete.

Constant for #colorMode: a value indicating that the color mode is undefined

ColorModeWideColorGamutMask
Obsolete.

Constant for #colorMode: bits that encode whether the screen is wide gamut.

ColorModeWideColorGamutNo
Obsolete.

Constant for #colorMode: a #COLOR_MODE_WIDE_COLOR_GAMUT_MASK value indicating that the screen is not wide gamut.

ColorModeWideColorGamutUndefined
Obsolete.

Constant for #colorMode: a #COLOR_MODE_WIDE_COLOR_GAMUT_MASK value indicating that it is unknown whether or not the screen is wide gamut.

ColorModeWideColorGamutYes
Obsolete.

Constant for #colorMode: a #COLOR_MODE_WIDE_COLOR_GAMUT_MASK value indicating that the screen is wide gamut.

DensityDpiUndefined

Default value for #densityDpi indicating that no width has been specified.

FontWeightAdjustmentUndefined

An undefined fontWeightAdjustment.

GrammaticalGenderFeminine
Obsolete.

Constant for grammatical gender: to indicate the terms of address the user preferred in an application is feminine.

GrammaticalGenderMasculine
Obsolete.

Constant for grammatical gender: to indicate the terms of address the user preferred in an application is masculine.

GrammaticalGenderNeutral
Obsolete.

Constant for grammatical gender: to indicate the terms of address the user preferred in an application is neuter.

GrammaticalGenderNotSpecified
Obsolete.

Constant for grammatical gender: to indicate the user has not specified the terms of address for the application.

MncZero

Constant used to to represent MNC (Mobile Network Code) zero.

ScreenHeightDpUndefined
Obsolete.

Default value for #screenHeightDp indicating that no width has been specified.

ScreenWidthDpUndefined
Obsolete.

Default value for #screenWidthDp indicating that no width has been specified.

SmallestScreenWidthDpUndefined

Default value for #smallestScreenWidthDp indicating that no width has been specified.

UiModeNightMask
Obsolete.

Constant for #uiMode: bits that encode the night mode.

UiModeNightNo
Obsolete.

Constant for #uiMode: a #UI_MODE_NIGHT_MASK value that corresponds to the notnight resource qualifier.

UiModeNightUndefined
Obsolete.

Constant for #uiMode: a #UI_MODE_NIGHT_MASK value indicating that no mode type has been set.

UiModeNightYes
Obsolete.

Constant for #uiMode: a #UI_MODE_NIGHT_MASK value that corresponds to the night resource qualifier.

UiModeTypeAppliance
Obsolete.

Constant for #uiMode: a #UI_MODE_TYPE_MASK value that corresponds to the appliance resource qualifier.

UiModeTypeCar
Obsolete.

Constant for #uiMode: a #UI_MODE_TYPE_MASK value that corresponds to the car resource qualifier.

UiModeTypeDesk
Obsolete.

Constant for #uiMode: a #UI_MODE_TYPE_MASK value that corresponds to the desk resource qualifier.

UiModeTypeMask
Obsolete.

Constant for #uiMode: bits that encode the mode type.

UiModeTypeNormal
Obsolete.

Constant for #uiMode: a #UI_MODE_TYPE_MASK value that corresponds to no UI mode resource qualifier specified.

UiModeTypeTelevision
Obsolete.

Constant for #uiMode: a #UI_MODE_TYPE_MASK value that corresponds to the television resource qualifier.

UiModeTypeUndefined
Obsolete.

Constant for #uiMode: a #UI_MODE_TYPE_MASK value indicating that no mode type has been set.

UiModeTypeVrHeadset
Obsolete.

Constant for #uiMode: a #UI_MODE_TYPE_MASK value that corresponds to the vrheadset resource qualifier.

UiModeTypeWatch
Obsolete.

Constant for #uiMode: a #UI_MODE_TYPE_MASK value that corresponds to the watch resource qualifier.

Properties

Class

Returns the runtime class of this Object.

(Inherited from Object)
ColorMode
Creator
DensityDpi

The target screen density being rendered to, corresponding to density resource qualifier.

FontScale

Current user preference for the scaling factor for fonts, relative to the base density scaling.

FontWeightAdjustment

Adjustment in text font weight.

GrammaticalGender

Returns the user preference for the grammatical gender.

Handle

The handle to the underlying Android instance.

(Inherited from Object)
HardKeyboardHidden

A flag indicating whether the hard keyboard has been hidden.

IsNightModeActive

Retuns whether the configuration is in night mode

IsScreenHdr

Return whether the screen has a high dynamic range.

IsScreenRound

Return whether the screen has a round shape.

IsScreenWideColorGamut

Return whether the screen has a wide color gamut and wide color gamut rendering is supported by this device.

JniIdentityHashCode (Inherited from Object)
JniPeerMembers
Keyboard

The kind of keyboard attached to the device.

KeyboardHidden

A flag indicating whether any keyboard is available.

LayoutDirection

Return the layout direction.

Locale

Current user preference for the locale, corresponding to locale resource qualifier.

Locales

Get the locale list. -or- Set the locale list.

Mcc

IMSI MCC (Mobile Country Code), corresponding to mcc resource qualifier.

Mnc

IMSI MNC (Mobile Network Code), corresponding to mnc resource qualifier.

Navigation

The kind of navigation method available on the device.

NavigationHidden

A flag indicating whether any 5-way or DPAD navigation available.

Orientation

Overall orientation of the screen.

PeerReference (Inherited from Object)
ScreenHeightDp

The height of the available screen space in dp units excluding the area occupied by android.view.WindowInsets window insets, such as the status bar, navigation bar, and cutouts.

ScreenLayout

Bit mask of overall layout of the screen.

ScreenWidthDp

The width of the available screen space in dp units excluding the area occupied by android.view.WindowInsets window insets.

SmallestScreenWidthDp

The smallest screen size an application will see in normal operation.

ThresholdClass

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

(Inherited from Object)
ThresholdType

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

(Inherited from Object)
Touchscreen

The kind of touch screen attached to the device.

UiMode

Bit mask of the ui mode.

Methods

Clone()

Creates and returns a copy of this object.

(Inherited from Object)
CompareTo(Configuration)
DescribeContents()

Parcelable methods

Diff(Configuration)

Return a bit mask of the differences between this Configuration object and the given one.

Dispose() (Inherited from Object)
Dispose(Boolean) (Inherited from Object)
Equals(Configuration)
Equals(Object)

Indicates whether some other object is "equal to" this one.

(Inherited from Object)
GenerateDelta(Configuration, Configuration)

Generate a delta Configuration between base and change.

GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
IsLayoutSizeAtLeast(Int32)

Check if the Configuration's current #screenLayout is at least the given size.

JavaFinalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

(Inherited from Object)
NeedNewResources(ConfigChanges, ConfigChanges)

Determines if a new resource needs to be loaded from the bit set of configuration changes returned by #updateFrom(Configuration).

Notify()

Wakes up a single thread that is waiting on this object's monitor.

(Inherited from Object)
NotifyAll()

Wakes up all threads that are waiting on this object's monitor.

(Inherited from Object)
ReadFromParcel(Parcel)
SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
SetLayoutDirection(Locale)

Set the layout direction from a Locale.

SetLocale(Locale)

Set the locale list to a list of just one locale.

SetTo(Configuration)

Sets the fields in this object to those in the given Configuration.

SetToDefaults()

Set this object to the system defaults.

ToArray<T>() (Inherited from Object)
ToString()

Returns a string representation of the object.

(Inherited from Object)
UnregisterFromRuntime() (Inherited from Object)
UpdateFrom(Configuration)

Copies the fields from delta into this Configuration object, keeping track of which ones have changed.

Wait()

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>.

(Inherited from Object)
Wait(Int64)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
Wait(Int64, Int32)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
WriteToParcel(Parcel, ParcelableWriteFlags)

Flatten this object in to a Parcel.

Explicit Interface Implementations

IComparable.CompareTo(Object)
IJavaPeerable.Disposed() (Inherited from Object)
IJavaPeerable.DisposeUnlessReferenced() (Inherited from Object)
IJavaPeerable.Finalized() (Inherited from Object)
IJavaPeerable.JniManagedPeerState (Inherited from Object)
IJavaPeerable.SetJniIdentityHashCode(Int32) (Inherited from Object)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) (Inherited from Object)
IJavaPeerable.SetPeerReference(JniObjectReference) (Inherited from Object)

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)

Applies to