Build 1.0_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 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 the keyboard has been hidden.
static int KEYBOARDHIDDEN_NO
           
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
           
 
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)
          Returns an integer indicating the relative positions of the receiver and the argument in the natural order of elements of the receiver's class.
 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 the argument to the receiver, and returns true if they represent the same object using a class specific comparison.
 int hashCode()
          Returns an integer hash code for the receiver.
 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 the receiver.
 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.


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

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.


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 the receiver.

Overrides:
toString in class Object
Returns:
String a printable representation for the receiver.

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
Returns an integer indicating the relative positions of the receiver and the argument in the natural order of elements of the receiver's class.

Specified by:
compareTo in interface Comparable<Configuration>
Parameters:
that - Object an object to compare the receiver to
Returns:
int which should be <0 if="" the="" receiver="" should="" sort="" before="" the="" argument,="" 0="" if="" the="" receiver="" should="" sort="" in="" the="" same="" position="" as="" the="" argument,="" and="">0 if the receiver should sort after the argument.

equals

public boolean equals(Configuration that)

equals

public boolean equals(Object that)
Description copied from class: Object
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 (==).

Overrides:
equals in class Object
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.
See Also:
Object.hashCode()

hashCode

public int hashCode()
Description copied from class: Object
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.

Overrides:
hashCode in class Object
Returns:
int the receiver's hash.
See Also:
Object.equals(java.lang.Object)

Build 1.0_r1(from source)

Please submit a feedback, bug or feature