com.android.resources
Enum Density

java.lang.Object
  extended by java.lang.Enum<Density>
      extended by com.android.resources.Density
All Implemented Interfaces:
ResourceEnum, java.io.Serializable, java.lang.Comparable<Density>

public enum Density
extends java.lang.Enum<Density>
implements ResourceEnum

Density enum.

This is used in the manifest in the uses-configuration node and in the resource folder names as well as other places needing to know the density values.


Enum Constant Summary
DPI_400
           
DPI_560
           
HIGH
           
LOW
           
MEDIUM
           
NODPI
           
TV
           
XHIGH
           
XXHIGH
           
XXXHIGH
           
 
Field Summary
static int DEFAULT_DENSITY
           
 
Method Summary
static Density getByIndex(int index)
           
 int getDpiValue()
           
static Density getEnum(int value)
          Returns the enum matching the given density value
static Density getEnum(java.lang.String value)
          Returns the enum matching the provided qualifier value.
static int getIndex(Density value)
           
 java.lang.String getLegacyValue()
           
 java.lang.String getLongDisplayValue()
          Returns a long string for display value.
 java.lang.String getResourceValue()
          Returns the resource string.
 java.lang.String getShortDisplayValue()
          Returns a short string for display value.
 boolean isFakeValue()
          Whether the value is neither used for device nor resources.
 boolean isRecommended()
          Returns true if this density is relevant for app developers (e.g.
 boolean isValidValueForDevice()
          Whether the value actually used on device.
 int since()
           
static Density valueOf(java.lang.String name)
          Returns the enum constant of this type with the specified name.
static Density[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

XXXHIGH

public static final Density XXXHIGH

DPI_560

public static final Density DPI_560

XXHIGH

public static final Density XXHIGH

DPI_400

public static final Density DPI_400

XHIGH

public static final Density XHIGH

HIGH

public static final Density HIGH

TV

public static final Density TV

MEDIUM

public static final Density MEDIUM

LOW

public static final Density LOW

NODPI

public static final Density NODPI
Field Detail

DEFAULT_DENSITY

public static final int DEFAULT_DENSITY
See Also:
Constant Field Values
Method Detail

values

public static Density[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (Density c : Density.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static Density valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
java.lang.NullPointerException - if the argument is null

getEnum

public static Density getEnum(java.lang.String value)
Returns the enum matching the provided qualifier value.

Parameters:
value - The qualifier value.
Returns:
the enum for the qualifier value or null if no match was found.

getEnum

public static Density getEnum(int value)
Returns the enum matching the given density value

Parameters:
value - The density value.
Returns:
the enum for the density value or null if no match was found.

getResourceValue

public java.lang.String getResourceValue()
Description copied from interface: ResourceEnum
Returns the resource string. This is to be used in resource folder names.

Specified by:
getResourceValue in interface ResourceEnum

getDpiValue

public int getDpiValue()

since

public int since()

getLegacyValue

public java.lang.String getLegacyValue()

getShortDisplayValue

public java.lang.String getShortDisplayValue()
Description copied from interface: ResourceEnum
Returns a short string for display value. The string does not need to show the context.

For instance "exposed", which can be the value for the keyboard state or the navigation state, would be valid since something else in the UI is expected to show if this is about the keyboard or the navigation state.

Specified by:
getShortDisplayValue in interface ResourceEnum
See Also:
ResourceEnum.getLongDisplayValue()

getLongDisplayValue

public java.lang.String getLongDisplayValue()
Description copied from interface: ResourceEnum
Returns a long string for display value. This must not only include the enum value but context (qualifier) about what the value represents.

For instance "Exposed keyboard", and "Export navigation", as "exposed" would not be enough to know what qualifier the value is about.

Specified by:
getLongDisplayValue in interface ResourceEnum
See Also:
ResourceEnum.getShortDisplayValue()

getIndex

public static int getIndex(Density value)

getByIndex

public static Density getByIndex(int index)

isRecommended

public boolean isRecommended()
Returns true if this density is relevant for app developers (e.g. a density you should consider providing resources for)


isFakeValue

public boolean isFakeValue()
Description copied from interface: ResourceEnum
Whether the value is neither used for device nor resources. This returns false when the value is only used for internal usage in the custom editors.

Specified by:
isFakeValue in interface ResourceEnum

isValidValueForDevice

public boolean isValidValueForDevice()
Description copied from interface: ResourceEnum
Whether the value actually used on device. This returns true only if a device can report this value, false if it's just used to qualify resources.

Specified by:
isValidValueForDevice in interface ResourceEnum