android.content.res
public
final
class
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 and scaling) as well
as dynamic device configuration (various types of input devices).
Summary
Constants
Fields
public |
|
|
float |
fontScale |
Current user preference for the scaling factor for fonts, relative
to the base density scaling. |
public |
|
|
int |
keyboard |
The kind of keyboard attached to the device. |
public |
|
|
int |
keyboardHidden |
A flag indicating whether the keyboard has been hidden. |
public |
|
|
Locale |
locale |
Current user preference for the locale. |
public |
|
|
int |
mcc |
IMSI MCC (Mobile Country Code). |
public |
|
|
int |
mnc |
IMSI MNC (Mobile Network Code). |
public |
|
|
int |
navigation |
The kind of navigation method available on the device. |
public |
|
|
int |
orientation |
Overall orientation of the screen. |
public |
|
|
int |
touchscreen |
The kind of touch screen attached to the device. |
Public Constructors
Public Methods
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait
Details
Constants
public
static
final
int
KEYBOARDHIDDEN_NO
Constant Value:
1
(0x00000001)
public
static
final
int
KEYBOARDHIDDEN_UNDEFINED
Constant Value:
0
(0x00000000)
public
static
final
int
KEYBOARDHIDDEN_YES
Constant Value:
2
(0x00000002)
public
static
final
int
KEYBOARD_12KEY
Constant Value:
3
(0x00000003)
public
static
final
int
KEYBOARD_NOKEYS
Constant Value:
1
(0x00000001)
public
static
final
int
KEYBOARD_QWERTY
Constant Value:
2
(0x00000002)
public
static
final
int
KEYBOARD_UNDEFINED
Constant Value:
0
(0x00000000)
public
static
final
int
NAVIGATION_DPAD
Constant Value:
2
(0x00000002)
public
static
final
int
NAVIGATION_NONAV
Constant Value:
1
(0x00000001)
public
static
final
int
NAVIGATION_TRACKBALL
Constant Value:
3
(0x00000003)
public
static
final
int
NAVIGATION_UNDEFINED
Constant Value:
0
(0x00000000)
public
static
final
int
NAVIGATION_WHEEL
Constant Value:
4
(0x00000004)
public
static
final
int
ORIENTATION_LANDSCAPE
Constant Value:
2
(0x00000002)
public
static
final
int
ORIENTATION_PORTRAIT
Constant Value:
1
(0x00000001)
public
static
final
int
ORIENTATION_SQUARE
Constant Value:
3
(0x00000003)
public
static
final
int
ORIENTATION_UNDEFINED
Constant Value:
0
(0x00000000)
public
static
final
int
TOUCHSCREEN_FINGER
Constant Value:
3
(0x00000003)
public
static
final
int
TOUCHSCREEN_NOTOUCH
Constant Value:
1
(0x00000001)
public
static
final
int
TOUCHSCREEN_STYLUS
Constant Value:
2
(0x00000002)
public
static
final
int
TOUCHSCREEN_UNDEFINED
Constant Value:
0
(0x00000000)
Fields
public
float
fontScale
Current user preference for the scaling factor for fonts, relative
to the base density scaling.
public
int
keyboardHidden
A flag indicating whether the keyboard has been hidden. This will
be set on a device with a mechanism to hide the keyboard from the
user, when that mechanism is closed.
public
Locale
locale
Current user preference for the locale.
public
int
mcc
IMSI MCC (Mobile Country Code). 0 if undefined.
public
int
mnc
IMSI MNC (Mobile Network Code). 0 if undefined.
Public Constructors
public
Configuration()
Construct an invalid Configuration. You must call
setToDefaults()
for this object to be valid.
Makes a deep copy suitable for modification.
Public Methods
public
int
describeContents()
Parcelable methods
Return a bit mask of the differences between this Configuration
object and the given one. Does not change the values of either. Any
undefined fields in
delta are ignored.
public
boolean
equals(Object that)
Compares the argument to the receiver, and returns true if they represent
the
same object using a class specific comparison. The
implementation in Object returns true only if the argument is the exact
same object as the receiver (==).
Parameters
that
| Object the object to compare with this object. |
Returns
- boolean
true
if the object is the same as this
object false
if it is different from this object.
public
int
hashCode()
Returns an integer hash code for the receiver. Any two objects which
answer
true
when passed to
.equals
must
answer the same value for this method.
public
static
boolean
needNewResources(int configChanges, int interestingChanges)
Determine if a new resource needs to be loaded from the bit set of
configuration changes returned by
updateFrom(Configuration).
Returns
- Return true if the resource needs to be loaded, else false.
public
void
setToDefaults()
Set this object to the system defaults.
public
String
toString()
Returns a string containing a concise, human-readable description of the
receiver.
Returns
- String a printable representation for the receiver.
public
int
updateFrom(Configuration delta)
Copy the fields from delta into this Configuration object, keeping
track of which ones have changed. Any undefined fields in
delta are ignored and not copied in to the current
Configuration.
public
void
writeToParcel(Parcel dest, int flags)
Flatten this object in to a Parcel.