Build 1.1_r1 (from source)

android.content.res
Class Configuration

java.lang.Object
  extended by android.content.res.Configuration
All Implemented Interfaces:
Parcelable, Comparable<Configuration>

public final class Configuration
extends Object
implements Parcelable, Comparable<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).


Nested Class Summary
 
Nested classes/interfaces inherited from interface android.os.Parcelable
Parcelable.Creator<T>
 
Field Summary
static Parcelable.Creator<Configuration> CREATOR
           
 float fontScale
          Current user preference for the scaling factor for fonts, relative to the base density scaling.
 int hardKeyboardHidden
          A flag indicating whether the hard keyboard has been hidden.
static int HARDKEYBOARDHIDDEN_NO
           
static int HARDKEYBOARDHIDDEN_UNDEFINED
           
static int HARDKEYBOARDHIDDEN_YES
           
 int keyboard
          The kind of keyboard attached to the device.
static int KEYBOARD_12KEY
           
static int KEYBOARD_NOKEYS
           
static int KEYBOARD_QWERTY
           
static int KEYBOARD_UNDEFINED
           
 int keyboardHidden
          A flag indicating whether any keyboard is available.
static int KEYBOARDHIDDEN_NO
           
static int KEYBOARDHIDDEN_SOFT
          Constant matching actual resource implementation.
static int KEYBOARDHIDDEN_UNDEFINED
           
static int KEYBOARDHIDDEN_YES
           
 Locale locale
          Current user preference for the locale.
 int mcc
          IMSI MCC (Mobile Country Code).
 int mnc
          IMSI MNC (Mobile Network Code).
 int navigation
          The kind of navigation method available on the device.
static int NAVIGATION_DPAD
           
static int NAVIGATION_NONAV
           
static int NAVIGATION_TRACKBALL
           
static int NAVIGATION_UNDEFINED
           
static int NAVIGATION_WHEEL
           
 int orientation
          Overall orientation of the screen.
static int ORIENTATION_LANDSCAPE
           
static int ORIENTATION_PORTRAIT
           
static int ORIENTATION_SQUARE
           
static int ORIENTATION_UNDEFINED
           
 int touchscreen
          The kind of touch screen attached to the device.
static int TOUCHSCREEN_FINGER
           
static int TOUCHSCREEN_NOTOUCH
           
static int TOUCHSCREEN_STYLUS
           
static int TOUCHSCREEN_UNDEFINED
           
 boolean userSetLocale
          Locale should persist on setting
 
Fields inherited from interface android.os.Parcelable
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE
 
Constructor Summary
Configuration()
          Construct an invalid Configuration.
Configuration(Configuration o)
          Makes a deep copy suitable for modification.
 
Method Summary
 int compareTo(Configuration that)
          Compares this object to the specified object to determine their relative order.
 int describeContents()
          Parcelable methods
 int diff(Configuration delta)
          Return a bit mask of the differences between this Configuration object and the given one.
 boolean equals(Configuration that)
           
 boolean equals(Object that)
          Compares this instance with the specified object and indicates if they are equal.
 int hashCode()
          Returns an integer hash code for this object.
 void makeDefault()
          Deprecated. 
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).
 void setToDefaults()
          Set this object to the system defaults.
 String toString()
          Returns a string containing a concise, human-readable description of this object.
 int updateFrom(Configuration delta)
          Copy the fields from delta into this Configuration object, keeping track of which ones have changed.
 void writeToParcel(Parcel dest, int flags)
          Flatten this object in to a Parcel.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

fontScale

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


mcc

public int mcc
IMSI MCC (Mobile Country Code). 0 if undefined.


mnc

public int mnc
IMSI MNC (Mobile Network Code). 0 if undefined.


locale

public Locale locale
Current user preference for the locale.


userSetLocale

public boolean userSetLocale
Locale should persist on setting


TOUCHSCREEN_UNDEFINED

public static final int TOUCHSCREEN_UNDEFINED
See Also:
Constant Field Values

TOUCHSCREEN_NOTOUCH

public static final int TOUCHSCREEN_NOTOUCH
See Also:
Constant Field Values

TOUCHSCREEN_STYLUS

public static final int TOUCHSCREEN_STYLUS
See Also:
Constant Field Values

TOUCHSCREEN_FINGER

public static final int TOUCHSCREEN_FINGER
See Also:
Constant Field Values

touchscreen

public int touchscreen
The kind of touch screen attached to the device. One of: TOUCHSCREEN_NOTOUCH, TOUCHSCREEN_STYLUS, TOUCHSCREEN_FINGER.


KEYBOARD_UNDEFINED

public static final int KEYBOARD_UNDEFINED
See Also:
Constant Field Values

KEYBOARD_NOKEYS

public static final int KEYBOARD_NOKEYS
See Also:
Constant Field Values

KEYBOARD_QWERTY

public static final int KEYBOARD_QWERTY
See Also:
Constant Field Values

KEYBOARD_12KEY

public static final int KEYBOARD_12KEY
See Also:
Constant Field Values

keyboard

public int keyboard
The kind of keyboard attached to the device. One of: KEYBOARD_QWERTY, KEYBOARD_12KEY.


KEYBOARDHIDDEN_UNDEFINED

public static final int KEYBOARDHIDDEN_UNDEFINED
See Also:
Constant Field Values

KEYBOARDHIDDEN_NO

public static final int KEYBOARDHIDDEN_NO
See Also:
Constant Field Values

KEYBOARDHIDDEN_YES

public static final int KEYBOARDHIDDEN_YES
See Also:
Constant Field Values

KEYBOARDHIDDEN_SOFT

public static final int KEYBOARDHIDDEN_SOFT
Constant matching actual resource implementation.

See Also:
Constant Field Values

keyboardHidden

public int keyboardHidden
A flag indicating whether any keyboard is available. Unlike hardKeyboardHidden, this also takes into account a soft keyboard, so if the hard keyboard is hidden but there is soft keyboard available, it will be set to NO. Value is one of: KEYBOARDHIDDEN_NO, KEYBOARDHIDDEN_YES.


HARDKEYBOARDHIDDEN_UNDEFINED

public static final int HARDKEYBOARDHIDDEN_UNDEFINED
See Also:
Constant Field Values

HARDKEYBOARDHIDDEN_NO

public static final int HARDKEYBOARDHIDDEN_NO
See Also:
Constant Field Values

HARDKEYBOARDHIDDEN_YES

public static final int HARDKEYBOARDHIDDEN_YES
See Also:
Constant Field Values

hardKeyboardHidden

public int hardKeyboardHidden
A flag indicating whether the hard 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. One of: HARDKEYBOARDHIDDEN_NO, HARDKEYBOARDHIDDEN_YES.


NAVIGATION_UNDEFINED

public static final int NAVIGATION_UNDEFINED
See Also:
Constant Field Values

NAVIGATION_NONAV

public static final int NAVIGATION_NONAV
See Also:
Constant Field Values

NAVIGATION_DPAD

public static final int NAVIGATION_DPAD
See Also:
Constant Field Values

NAVIGATION_TRACKBALL

public static final int NAVIGATION_TRACKBALL
See Also:
Constant Field Values

NAVIGATION_WHEEL

public static final int NAVIGATION_WHEEL
See Also:
Constant Field Values

navigation

public int navigation
The kind of navigation method available on the device. One of: NAVIGATION_DPAD, NAVIGATION_TRACKBALL, NAVIGATION_WHEEL.


ORIENTATION_UNDEFINED

public static final int ORIENTATION_UNDEFINED
See Also:
Constant Field Values

ORIENTATION_PORTRAIT

public static final int ORIENTATION_PORTRAIT
See Also:
Constant Field Values

ORIENTATION_LANDSCAPE

public static final int ORIENTATION_LANDSCAPE
See Also:
Constant Field Values

ORIENTATION_SQUARE

public static final int ORIENTATION_SQUARE
See Also:
Constant Field Values

orientation

public int orientation
Overall orientation of the screen. May be one of ORIENTATION_LANDSCAPE, ORIENTATION_PORTRAIT, or ORIENTATION_SQUARE.


CREATOR

public static final Parcelable.Creator<Configuration> CREATOR
Constructor Detail

Configuration

public Configuration()
Construct an invalid Configuration. You must call setToDefaults() for this object to be valid.


Configuration

public Configuration(Configuration o)
Makes a deep copy suitable for modification.

Method Detail

toString

public String toString()
Description copied from class: Object
Returns a string containing a concise, human-readable description of this object. Subclasses are encouraged to override this method and provide an implementation that takes into account the object's type and data. The default implementation simply concatenates the class name, the '@' sign and a hexadecimal representation of the object's Object.hashCode(), that is, it is equivalent to the following expression:
 getClass().getName() + '@' + Integer.toHexString(hashCode())
 

Overrides:
toString in class Object
Returns:
a printable representation of this object.

setToDefaults

public void setToDefaults()
Set this object to the system defaults.


makeDefault

@Deprecated
public void makeDefault()
Deprecated. 


updateFrom

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.

Returns:
Returns a bit mask of the changed fields, as per diff(android.content.res.Configuration).

diff

public int diff(Configuration delta)
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.

Returns:
Returns a bit mask indicating which configuration values has changed, containing any combination of PackageManager.ActivityInfo.CONFIG_FONT_SCALE, PackageManager.ActivityInfo.CONFIG_MCC, PackageManager.ActivityInfo.CONFIG_MNC, PackageManager.ActivityInfo.CONFIG_LOCALE, PackageManager.ActivityInfo.CONFIG_TOUCHSCREEN, PackageManager.ActivityInfo.CONFIG_KEYBOARD, PackageManager.ActivityInfo.CONFIG_NAVIGATION, or PackageManager.ActivityInfo.CONFIG_ORIENTATION.

needNewResources

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

Parameters:
configChanges - The mask of changes configurations as returned by updateFrom(Configuration).
interestingChanges - The configuration changes that the resource can handled, as given in TypedValue.changingConfigurations.
Returns:
Return true if the resource needs to be loaded, else false.

describeContents

public int describeContents()
Parcelable methods

Specified by:
describeContents in interface Parcelable
Returns:
a bitmask indicating the set of special object types marshalled by the Parcelable.

writeToParcel

public void writeToParcel(Parcel dest,
                          int flags)
Description copied from interface: Parcelable
Flatten this object in to a Parcel.

Specified by:
writeToParcel in interface Parcelable
Parameters:
dest - The Parcel in which the object should be written.
flags - Additional flags about how the object should be written. May be 0 or Parcelable.PARCELABLE_WRITE_RETURN_VALUE.

compareTo

public int compareTo(Configuration that)
Description copied from interface: Comparable
Compares this object to the specified object to determine their relative order.

Specified by:
compareTo in interface Comparable<Configuration>
Parameters:
that - the object to compare to this instance.
Returns:
a negative integer if this instance is less than another; a positive integer if this instance is greater than another; 0 if this instance has the same order as another.

equals

public boolean equals(Configuration that)

equals

public boolean equals(Object that)
Description copied from class: Object
Compares this instance with the specified object and indicates if they are equal. In order to be equal, o must represent the same object as this instance using a class-specific comparison. The general contract is that this comparison should be both transitive and reflexive.

The implementation in Object returns true only if o is the exact same object as the receiver (using the == operator for comparison). Subclasses often implement equals(Object) so that it takes into account the two object's types and states.

The general contract for the equals(Object) and Object.hashCode() methods is that if equals returns true for any two objects, then hashCode() must return the same value for these objects. This means that subclasses of Object usually override either both methods or none of them.

Overrides:
equals in class Object
Parameters:
that - the object to compare this instance with.
Returns:
true if the specified object is equal to this Object; false otherwise.
See Also:
Object.hashCode()

hashCode

public int hashCode()
Description copied from class: Object
Returns an integer hash code for this object. By contract, any two objects for which equals(Object) returns true must return the same hash code value. This means that subclasses of Object usually override both methods or neither method.

Overrides:
hashCode in class Object
Returns:
this object's hash code.
See Also:
Object.equals(java.lang.Object)

Build 1.1_r1 (from source)

Please submit a feedback, bug or feature