public final class ResourceHelper2 extends Object
Helper class to provide various conversion method used in handling android resources.
Constructor and Description |
---|
ResourceHelper2() |
Modifier and Type | Method and Description |
---|---|
static TypedValue |
getValue(String attribute,
String value,
boolean requireUnit)
Returns the raw value from the given attribute float-type value string.
|
static boolean |
parseFloatAttribute(String attribute,
String value,
TypedValue outValue,
boolean requireUnit)
Parse a float attribute and return the parsed value into a given TypedValue.
|
public static TypedValue getValue(String attribute, String value, boolean requireUnit)
Returns the raw value from the given attribute float-type value string. This object is only valid until the next call on to ResourceHelper2
.
attribute
- Attribute name.value
- Attribute value.requireUnit
- whether the value is expected to contain a unit.public static boolean parseFloatAttribute(String attribute, String value, TypedValue outValue, boolean requireUnit)
Parse a float attribute and return the parsed value into a given TypedValue.
attribute
- the name of the attribute. Can be null if requireUnit is false.value
- the string value of the attributeoutValue
- the TypedValue to receive the parsed valuerequireUnit
- whether the value is expected to contain a unit.