Configuration
class Configuration : Comparable<Configuration!>, Parcelable
| kotlin.Any | |
| ↳ | android.content.res.Configuration |
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();
Summary
| Constants | |
|---|---|
| static Int |
Constant for |
| static Int |
Constant for |
| static Int |
Constant for |
| static Int |
Constant for |
| static Int |
Constant for |
| static Int |
Constant for |
| static Int |
Constant for |
| static Int |
Constant for |
| static Int |
Constant for |
| static Int |
Constant for |
| static Int |
Default value for |
| static Int |
An undefined fontWeightAdjustment. |
| static Int |
Constant for grammatical gender: to indicate the terms of address the user preferred in an application is feminine. |
| static Int |
Constant for grammatical gender: to indicate the terms of address the user preferred in an application is masculine. |
| static Int |
Constant for grammatical gender: to indicate the terms of address the user preferred in an application is neuter. |
| static Int |
Constant for grammatical gender: to indicate the user has not specified the terms of address for the application. |
| static Int |
Constant for |
| static Int |
Constant for |
| static Int |
Constant for |
| static Int |
Constant for |
| static Int |
Constant for |
| static Int |
Constant for |
| static Int |
Constant for |
| static Int |
Constant for |
| static Int |
Constant for |
| static Int |
Constant for |
| static Int |
Constant used to to represent MNC (Mobile Network Code) zero. |
| static Int |
Constant for |
| static Int |
Constant for |
| static Int |
Constant for |
| static Int |
Constant for |
| static Int |
Constant for |
| static Int |
Constant for |
| static Int |
Constant for |
| static Int |
Constant for |
| static Int |
Constant for |
| static Int |
Constant for |
| static Int | |
| static Int |
Constant for |
| static Int |
Constant for |
| static Int |
Constant for |
| static Int |
Constant for |
| static Int |
Constant for |
| static Int |
Constant for |
| static Int |
Constant for |
| static Int |
Constant for |
| static Int |
Constant for |
| static Int |
Constant for |
| static Int |
Constant for |
| static Int |
Constant for |
| static Int |
Constant for |
| static Int |
Constant for |
| static Int |
Constant for |
| static Int |
Constant for |
| static Int |
Constant for |
| static Int |
Constant for |
| static Int |
Constant for |
| static Int |
Constant for |
| static Int |
Constant for |
| static Int |
Default value for |
| static Int |
Default value for |
| static Int |
Default value for |
| static Int |
Constant for |
| static Int |
Constant for |
| static Int | |
| static Int |
Constant for |
| static Int |
Constant for |
| static Int |
Constant for |
| static Int |
Constant for |
| static Int |
Constant for |
| static Int |
Constant for |
| static Int |
Constant for |
| static Int |
Constant for |
| static Int |
Constant for |
| static Int |
Constant for |
| static Int |
Constant for |
| static Int |
Constant for |
| static Int |
Constant for |
| static Int |
Constant for |
| Inherited constants | |
|---|---|
| Public constructors | |
|---|---|
|
Construct an invalid Configuration. |
|
|
Makes a deep copy suitable for modification. |
|
| Public methods | |
|---|---|
| Int |
compareTo(other: Configuration!)Compares this object with the specified object for order. |
| Int |
Parcelable methods |
| Int |
diff(delta: Configuration!)Return a bit mask of the differences between this Configuration object and the given one. |
| Boolean |
equals(that: Configuration!) |
| Boolean |
Indicates whether some other object is "equal to" this one. |
| static Configuration |
generateDelta(base: Configuration, change: Configuration)Generate a delta Configuration between |
| Int |
Returns the user preference for the grammatical gender. |
| Int |
Return the layout direction. |
| LocaleList |
Get the locale list. |
| Int |
hashCode()Returns a hash code value for the object. |
| Boolean |
isLayoutSizeAtLeast(size: Int)Check if the Configuration's current |
| Boolean |
Retuns whether the configuration is in night mode |
| Boolean |
Return whether the screen has a high dynamic range. |
| Boolean |
Return whether the screen has a round shape. |
| Boolean |
Return whether the screen has a wide color gamut and wide color gamut rendering is supported by this device. |
| static Boolean |
needNewResources(configChanges: Int, interestingChanges: Int)Determines if a new resource needs to be loaded from the bit set of configuration changes returned by |
| Unit |
readFromParcel(source: Parcel!) |
| Unit |
setLayoutDirection(loc: Locale!)Set the layout direction from a Locale. |
| Unit |
Set the locale list to a list of just one locale. |
| Unit |
setLocales(locales: LocaleList?)Set the locale list. |
| Unit |
setTo(o: Configuration!)Sets the fields in this object to those in the given Configuration. |
| Unit |
Set this object to the system defaults. |
| String |
toString()Returns a string representation of the object. |
| Int |
updateFrom(delta: Configuration)Copies the fields from delta into this Configuration object, keeping track of which ones have changed. |
| Unit |
writeToParcel(dest: Parcel, flags: Int)Flatten this object in to a Parcel. |
| Properties | |
|---|---|
| static Parcelable.Creator<Configuration!> | |
| Int |
Bit mask of color capabilities of the screen. |
| Int |
The target screen density being rendered to, corresponding to density resource qualifier. |
| Float |
Current user preference for the scaling factor for fonts, relative to the base density scaling. |
| Int |
Adjustment in text font weight. |
| Int |
A flag indicating whether the hard keyboard has been hidden. |
| Int |
The kind of keyboard attached to the device. |
| Int |
A flag indicating whether any keyboard is available. |
| Locale! |
Current user preference for the locale, corresponding to locale resource qualifier. |
| Int |
IMSI MCC (Mobile Country Code), corresponding to mcc resource qualifier. |
| Int |
IMSI MNC (Mobile Network Code), corresponding to mnc resource qualifier. |
| Int |
The kind of navigation method available on the device. |
| Int |
A flag indicating whether any 5-way or DPAD navigation available. |
| Int |
Overall orientation of the screen. |
| Int |
The height of the available screen space in dp units. |
| Int |
Bit mask of overall layout of the screen. |
| Int |
The width of the available screen space in dp units. |
| Int |
The smallest screen size an application will see in normal operation. |
| Int |
The kind of touch screen attached to the device. |
| Int |
Bit mask of the ui mode. |
Constants
COLOR_MODE_HDR_MASK
static val COLOR_MODE_HDR_MASK: Int
Constant for colorMode: bits that encode the dynamic range of the screen.
Value: 12COLOR_MODE_HDR_NO
static val COLOR_MODE_HDR_NO: Int
Constant for colorMode: a COLOR_MODE_HDR_MASK value indicating that the screen is not HDR (low/standard dynamic range).
Corresponds to the -lowdr resource qualifier.
Value: 4COLOR_MODE_HDR_SHIFT
static val COLOR_MODE_HDR_SHIFT: Int
Constant for colorMode: bits shift to get the screen dynamic range.
Value: 2COLOR_MODE_HDR_UNDEFINED
static val COLOR_MODE_HDR_UNDEFINED: Int
Constant for colorMode: a COLOR_MODE_HDR_MASK value indicating that it is unknown whether or not the screen is HDR.
Value: 0COLOR_MODE_HDR_YES
static val COLOR_MODE_HDR_YES: Int
Constant for colorMode: a COLOR_MODE_HDR_MASK value indicating that the screen is HDR (dynamic range).
Corresponds to the -highdr resource qualifier.
Value: 8COLOR_MODE_UNDEFINED
static val COLOR_MODE_UNDEFINED: Int
Constant for colorMode: a value indicating that the color mode is undefined
Value: 0COLOR_MODE_WIDE_COLOR_GAMUT_MASK
static val COLOR_MODE_WIDE_COLOR_GAMUT_MASK: Int
Constant for colorMode: bits that encode whether the screen is wide gamut.
Value: 3COLOR_MODE_WIDE_COLOR_GAMUT_NO
static val COLOR_MODE_WIDE_COLOR_GAMUT_NO: Int
Constant for colorMode: a COLOR_MODE_WIDE_COLOR_GAMUT_MASK value indicating that the screen is not wide gamut.
Corresponds to the -nowidecg resource qualifier.
Value: 1COLOR_MODE_WIDE_COLOR_GAMUT_UNDEFINED
static val COLOR_MODE_WIDE_COLOR_GAMUT_UNDEFINED: Int
Constant for colorMode: a COLOR_MODE_WIDE_COLOR_GAMUT_MASK value indicating that it is unknown whether or not the screen is wide gamut.
Value: 0COLOR_MODE_WIDE_COLOR_GAMUT_YES
static val COLOR_MODE_WIDE_COLOR_GAMUT_YES: Int
Constant for colorMode: a COLOR_MODE_WIDE_COLOR_GAMUT_MASK value indicating that the screen is wide gamut.
Corresponds to the -widecg resource qualifier.
Value: 2DENSITY_DPI_UNDEFINED
static val DENSITY_DPI_UNDEFINED: Int
Default value for densityDpi indicating that no width has been specified.
Value: 0FONT_WEIGHT_ADJUSTMENT_UNDEFINED
static val FONT_WEIGHT_ADJUSTMENT_UNDEFINED: Int
An undefined fontWeightAdjustment.
Value: 2147483647GRAMMATICAL_GENDER_FEMININE
static val GRAMMATICAL_GENDER_FEMININE: Int
Constant for grammatical gender: to indicate the terms of address the user preferred in an application is feminine.
Value: 2GRAMMATICAL_GENDER_MASCULINE
static val GRAMMATICAL_GENDER_MASCULINE: Int
Constant for grammatical gender: to indicate the terms of address the user preferred in an application is masculine.
Value: 3