Build 1.0_r1(from source)

android.util
Class XmlPullAttributes

java.lang.Object
  extended by android.util.XmlPullAttributes
All Implemented Interfaces:
AttributeSet

 class XmlPullAttributes
extends Object
implements AttributeSet

Provides an implementation of AttributeSet on top of an XmlPullParser.


Constructor Summary
XmlPullAttributes(XmlPullParser parser)
           
 
Method Summary
 boolean getAttributeBooleanValue(int index, boolean defaultValue)
          Return the boolean value of attribute at 'index'.
 boolean getAttributeBooleanValue(String namespace, String attribute, boolean defaultValue)
          Return the boolean value of 'attribute'.
 int getAttributeCount()
           
 float getAttributeFloatValue(int index, float defaultValue)
          Return the float value of attribute at 'index'.
 float getAttributeFloatValue(String namespace, String attribute, float defaultValue)
          Return the float value of 'attribute'.
 int getAttributeIntValue(int index, int defaultValue)
          Return the integer value of attribute at 'index'.
 int getAttributeIntValue(String namespace, String attribute, int defaultValue)
          Return the integer value of 'attribute'.
 int getAttributeListValue(int index, String[] options, int defaultValue)
          Return the index of the value of attribute at 'index' in the list 'options'.
 int getAttributeListValue(String namespace, String attribute, String[] options, int defaultValue)
          Return the index of the value of 'attribute' in the list 'options'.
 String getAttributeName(int index)
           
 int getAttributeNameResource(int index)
          Return the resource ID associated with the given attribute name.
 int getAttributeResourceValue(int index, int defaultValue)
          Return the value of attribute at 'index' as a resource identifier.
 int getAttributeResourceValue(String namespace, String attribute, int defaultValue)
          Return the value of 'attribute' as a resource identifier.
 int getAttributeUnsignedIntValue(int index, int defaultValue)
          Return the integer value of attribute at 'index' that is formatted as an unsigned value.
 int getAttributeUnsignedIntValue(String namespace, String attribute, int defaultValue)
          Return the boolean value of 'attribute' that is formatted as an unsigned value.
 String getAttributeValue(int index)
           
 String getAttributeValue(String namespace, String name)
           
 String getClassAttribute()
          Return the value of the "class" attribute or null if there is not one.
 String getIdAttribute()
          Return the value of the "id" attribute or null if there is not one.
 int getIdAttributeResourceValue(int defaultValue)
          Return the integer value of the "id" attribute or defaultValue if there is none.
 String getPositionDescription()
           
 int getStyleAttribute()
          Return the value of the "style" attribute or 0 if there is not one.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XmlPullAttributes

public XmlPullAttributes(XmlPullParser parser)
Method Detail

getAttributeCount

public int getAttributeCount()
Specified by:
getAttributeCount in interface AttributeSet

getAttributeName

public String getAttributeName(int index)
Specified by:
getAttributeName in interface AttributeSet

getAttributeValue

public String getAttributeValue(int index)
Specified by:
getAttributeValue in interface AttributeSet

getAttributeValue

public String getAttributeValue(String namespace,
                                String name)
Specified by:
getAttributeValue in interface AttributeSet

getPositionDescription

public String getPositionDescription()
Specified by:
getPositionDescription in interface AttributeSet

getAttributeNameResource

public int getAttributeNameResource(int index)
Description copied from interface: AttributeSet
Return the resource ID associated with the given attribute name. This will be the identifier for an attribute resource, which can be used by styles. Returns 0 if there is no resource associated with this attribute.

Note that this is different than AttributeSet.getAttributeResourceValue(java.lang.String, java.lang.String, int) in that it returns a resource identifier for the attribute name; the other method returns this attribute's value as a resource identifier.

Specified by:
getAttributeNameResource in interface AttributeSet
Parameters:
index - Index of the desired attribute, 0...count-1.
Returns:
The resource identifier, 0 if none.

getAttributeListValue

public int getAttributeListValue(String namespace,
                                 String attribute,
                                 String[] options,
                                 int defaultValue)
Description copied from interface: AttributeSet
Return the index of the value of 'attribute' in the list 'options'.

Specified by:
getAttributeListValue in interface AttributeSet
attribute - Name of attribute to retrieve.
options - List of strings whose values we are checking against.
defaultValue - Value returned if attribute doesn't exist or no match is found.
Returns:
Index in to 'options' or defaultValue.

getAttributeBooleanValue

public boolean getAttributeBooleanValue(String namespace,
                                        String attribute,
                                        boolean defaultValue)
Description copied from interface: AttributeSet
Return the boolean value of 'attribute'.

Specified by:
getAttributeBooleanValue in interface AttributeSet
attribute - The attribute to retrieve.
defaultValue - What to return if the attribute isn't found.
Returns:
Resulting value.

getAttributeResourceValue

public int getAttributeResourceValue(String namespace,
                                     String attribute,
                                     int defaultValue)
Description copied from interface: AttributeSet
Return the value of 'attribute' as a resource identifier.

Note that this is different than AttributeSet.getAttributeNameResource(int) in that it returns a the value contained in this attribute as a resource identifier (i.e., a value originally of the form "@package:type/resource"); the other method returns a resource identifier that identifies the name of the attribute.

Specified by:
getAttributeResourceValue in interface AttributeSet
attribute - The attribute to retrieve.
defaultValue - What to return if the attribute isn't found.
Returns:
Resulting value.

getAttributeIntValue

public int getAttributeIntValue(String namespace,
                                String attribute,
                                int defaultValue)
Description copied from interface: AttributeSet
Return the integer value of 'attribute'.

Specified by:
getAttributeIntValue in interface AttributeSet
attribute - The attribute to retrieve.
defaultValue - What to return if the attribute isn't found.
Returns:
Resulting value.

getAttributeUnsignedIntValue

public int getAttributeUnsignedIntValue(String namespace,
                                        String attribute,
                                        int defaultValue)
Description copied from interface: AttributeSet
Return the boolean value of 'attribute' that is formatted as an unsigned value. In particular, the formats 0xn...n and #n...n are handled.

Specified by:
getAttributeUnsignedIntValue in interface AttributeSet
attribute - The attribute to retrieve.
defaultValue - What to return if the attribute isn't found.
Returns:
Resulting value.

getAttributeFloatValue

public float getAttributeFloatValue(String namespace,
                                    String attribute,
                                    float defaultValue)
Description copied from interface: AttributeSet
Return the float value of 'attribute'.

Specified by:
getAttributeFloatValue in interface AttributeSet
attribute - The attribute to retrieve.
defaultValue - What to return if the attribute isn't found.
Returns:
Resulting value.

getAttributeListValue

public int getAttributeListValue(int index,
                                 String[] options,
                                 int defaultValue)
Description copied from interface: AttributeSet
Return the index of the value of attribute at 'index' in the list 'options'.

Specified by:
getAttributeListValue in interface AttributeSet
Parameters:
index - Index of the desired attribute, 0...count-1.
options - List of strings whose values we are checking against.
defaultValue - Value returned if attribute doesn't exist or no match is found.
Returns:
Index in to 'options' or defaultValue.

getAttributeBooleanValue

public boolean getAttributeBooleanValue(int index,
                                        boolean defaultValue)
Description copied from interface: AttributeSet
Return the boolean value of attribute at 'index'.

Specified by:
getAttributeBooleanValue in interface AttributeSet
Parameters:
index - Index of the desired attribute, 0...count-1.
defaultValue - What to return if the attribute isn't found.
Returns:
Resulting value.

getAttributeResourceValue

public int getAttributeResourceValue(int index,
                                     int defaultValue)
Description copied from interface: AttributeSet
Return the value of attribute at 'index' as a resource identifier.

Note that this is different than AttributeSet.getAttributeNameResource(int) in that it returns a the value contained in this attribute as a resource identifier (i.e., a value originally of the form "@package:type/resource"); the other method returns a resource identifier that identifies the name of the attribute.

Specified by:
getAttributeResourceValue in interface AttributeSet
Parameters:
index - Index of the desired attribute, 0...count-1.
defaultValue - What to return if the attribute isn't found.
Returns:
Resulting value.

getAttributeIntValue

public int getAttributeIntValue(int index,
                                int defaultValue)
Description copied from interface: AttributeSet
Return the integer value of attribute at 'index'.

Specified by:
getAttributeIntValue in interface AttributeSet
Parameters:
index - Index of the desired attribute, 0...count-1.
defaultValue - What to return if the attribute isn't found.
Returns:
Resulting value.

getAttributeUnsignedIntValue

public int getAttributeUnsignedIntValue(int index,
                                        int defaultValue)
Description copied from interface: AttributeSet
Return the integer value of attribute at 'index' that is formatted as an unsigned value. In particular, the formats 0xn...n and #n...n are handled.

Specified by:
getAttributeUnsignedIntValue in interface AttributeSet
Parameters:
index - Index of the desired attribute, 0...count-1.
defaultValue - What to return if the attribute isn't found.
Returns:
Resulting value.

getAttributeFloatValue

public float getAttributeFloatValue(int index,
                                    float defaultValue)
Description copied from interface: AttributeSet
Return the float value of attribute at 'index'.

Specified by:
getAttributeFloatValue in interface AttributeSet
Parameters:
index - Index of the desired attribute, 0...count-1.
defaultValue - What to return if the attribute isn't found.
Returns:
Resulting value.

getIdAttribute

public String getIdAttribute()
Description copied from interface: AttributeSet
Return the value of the "id" attribute or null if there is not one. Equivalent to getAttributeValue(null, "id").

Specified by:
getIdAttribute in interface AttributeSet
Returns:
The id attribute's value or null.

getClassAttribute

public String getClassAttribute()
Description copied from interface: AttributeSet
Return the value of the "class" attribute or null if there is not one. Equivalent to getAttributeValue(null, "class").

Specified by:
getClassAttribute in interface AttributeSet
Returns:
The class attribute's value or null.

getIdAttributeResourceValue

public int getIdAttributeResourceValue(int defaultValue)
Description copied from interface: AttributeSet
Return the integer value of the "id" attribute or defaultValue if there is none. Equivalent to getAttributeResourceValue(null, "id", defaultValue);

Specified by:
getIdAttributeResourceValue in interface AttributeSet
Parameters:
defaultValue - What to return if the "id" attribute isn't found.
Returns:
int Resulting value.

getStyleAttribute

public int getStyleAttribute()
Description copied from interface: AttributeSet
Return the value of the "style" attribute or 0 if there is not one. Equivalent to getAttributeResourceValue(null, "style").

Specified by:
getStyleAttribute in interface AttributeSet
Returns:
The style attribute's resource identifier or 0.

Build 1.0_r1(from source)

Please submit a feedback, bug or feature