# AttributeSet

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Summary:[Methods](https://developer.android.com/reference/android/util/AttributeSet#pubmethods)  

# AttributeSet

*** ** * ** ***

[Kotlin](https://developer.android.com/reference/kotlin/android/util/AttributeSet "View this page in Kotlin")\|Java

`
public


interface
AttributeSet
`  
`


`

|---------------------------|
| android.util.AttributeSet |

|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Known indirect subclasses [XmlResourceParser](https://developer.android.com/reference/android/content/res/XmlResourceParser) |----------------------------------------------------------------------------------------------------|---------------------------------------------------------| | [XmlResourceParser](https://developer.android.com/reference/android/content/res/XmlResourceParser) | The XML parsing interface returned for an XML resource. | |

<br />

*** ** * ** ***

A collection of attributes, as found associated with a tag in an XML document. Often you will not want to use this interface directly, instead passing it to[Resources.Theme.obtainStyledAttributes()](https://developer.android.com/reference/android/content/res/Resources.Theme#obtainStyledAttributes(android.util.AttributeSet,%20int[],%20int,%20int))which will take care of parsing the attributes for you. In particular, the Resources API will convert resource references (attribute values such as "@string/my_label" in the original XML) to the desired type for you; if you use AttributeSet directly then you will need to manually check for resource references (with[getAttributeResourceValue(int, int)](https://developer.android.com/reference/android/util/AttributeSet#getAttributeResourceValue(int,%20int))) and do the resource lookup yourself if needed. Direct use of AttributeSet also prevents the application of themes and styles when retrieving attribute values.

This interface provides an efficient mechanism for retrieving data from compiled XML files, which can be retrieved for a particular XmlPullParser through[Xml.asAttributeSet()](https://developer.android.com/reference/android/util/Xml#asAttributeSet(org.xmlpull.v1.XmlPullParser)). Normally this will return an implementation of the interface that works on top of a generic XmlPullParser, however it is more useful in conjunction with compiled XML resources:  

```
 XmlPullParser parser = resources.getXml(myResource);
 AttributeSet attributes = Xml.asAttributeSet(parser);
```

The implementation returned here, unlike using the implementation on top of a generic XmlPullParser, is highly optimized by retrieving pre-computed information that was generated by aapt when compiling your resources. For example, the[getAttributeFloatValue(int, float)](https://developer.android.com/reference/android/util/AttributeSet#getAttributeFloatValue(int,%20float))method returns a floating point number previous stored in the compiled resource instead of parsing at runtime the string originally in the XML file.

This interface also provides additional information contained in the compiled XML resource that is not available in a normal XML file, such as[getAttributeNameResource(int)](https://developer.android.com/reference/android/util/AttributeSet#getAttributeNameResource(int))which returns the resource identifier associated with a particular XML attribute name.  
**See also:**

- [XmlPullParser](https://developer.android.com/reference/org/xmlpull/v1/XmlPullParser)

## Summary

|                                                                                                                                                                                                                                                                                               ### Public methods                                                                                                                                                                                                                                                                                                ||
|--------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` abstract boolean`                                                            | ` `[getAttributeBooleanValue](https://developer.android.com/reference/android/util/AttributeSet#getAttributeBooleanValue(java.lang.String,%20java.lang.String,%20boolean))`(`[String](https://developer.android.com/reference/java/lang/String)` namespace, `[String](https://developer.android.com/reference/java/lang/String)` attribute, boolean defaultValue) ` Return the boolean value of 'attribute'.                                                                                                                    |
| ` abstract boolean`                                                            | ` `[getAttributeBooleanValue](https://developer.android.com/reference/android/util/AttributeSet#getAttributeBooleanValue(int,%20boolean))`(int index, boolean defaultValue) ` Return the boolean value of attribute at 'index'.                                                                                                                                                                                                                                                                                                 |
| ` abstract int`                                                                | ` `[getAttributeCount](https://developer.android.com/reference/android/util/AttributeSet#getAttributeCount())`() ` Returns the number of attributes available in the set.                                                                                                                                                                                                                                                                                                                                                       |
| ` abstract float`                                                              | ` `[getAttributeFloatValue](https://developer.android.com/reference/android/util/AttributeSet#getAttributeFloatValue(int,%20float))`(int index, float defaultValue) ` Return the float value of attribute at 'index'.                                                                                                                                                                                                                                                                                                           |
| ` abstract float`                                                              | ` `[getAttributeFloatValue](https://developer.android.com/reference/android/util/AttributeSet#getAttributeFloatValue(java.lang.String,%20java.lang.String,%20float))`(`[String](https://developer.android.com/reference/java/lang/String)` namespace, `[String](https://developer.android.com/reference/java/lang/String)` attribute, float defaultValue) ` Return the float value of 'attribute'.                                                                                                                              |
| ` abstract int`                                                                | ` `[getAttributeIntValue](https://developer.android.com/reference/android/util/AttributeSet#getAttributeIntValue(java.lang.String,%20java.lang.String,%20int))`(`[String](https://developer.android.com/reference/java/lang/String)` namespace, `[String](https://developer.android.com/reference/java/lang/String)` attribute, int defaultValue) ` Return the integer value of 'attribute'.                                                                                                                                    |
| ` abstract int`                                                                | ` `[getAttributeIntValue](https://developer.android.com/reference/android/util/AttributeSet#getAttributeIntValue(int,%20int))`(int index, int defaultValue) ` Return the integer value of attribute at 'index'.                                                                                                                                                                                                                                                                                                                 |
| ` abstract int`                                                                | ` `[getAttributeListValue](https://developer.android.com/reference/android/util/AttributeSet#getAttributeListValue(int,%20java.lang.String[],%20int))`(int index, `[String[]](https://developer.android.com/reference/java/lang/String)` options, int defaultValue) ` Return the index of the value of attribute at 'index' in the list 'options'.                                                                                                                                                                              |
| ` abstract int`                                                                | ` `[getAttributeListValue](https://developer.android.com/reference/android/util/AttributeSet#getAttributeListValue(java.lang.String,%20java.lang.String,%20java.lang.String[],%20int))`(`[String](https://developer.android.com/reference/java/lang/String)` namespace, `[String](https://developer.android.com/reference/java/lang/String)` attribute, `[String[]](https://developer.android.com/reference/java/lang/String)` options, int defaultValue) ` Return the index of the value of 'attribute' in the list 'options'. |
| ` abstract `[String](https://developer.android.com/reference/java/lang/String) | ` `[getAttributeName](https://developer.android.com/reference/android/util/AttributeSet#getAttributeName(int))`(int index) ` Returns the name of the specified attribute.                                                                                                                                                                                                                                                                                                                                                       |
| ` abstract int`                                                                | ` `[getAttributeNameResource](https://developer.android.com/reference/android/util/AttributeSet#getAttributeNameResource(int))`(int index) ` Return the resource ID associated with the given attribute name.                                                                                                                                                                                                                                                                                                                   |
| ` default `[String](https://developer.android.com/reference/java/lang/String)  | ` `[getAttributeNamespace](https://developer.android.com/reference/android/util/AttributeSet#getAttributeNamespace(int))`(int index) ` Returns the namespace of the specified attribute.                                                                                                                                                                                                                                                                                                                                        |
| ` abstract int`                                                                | ` `[getAttributeResourceValue](https://developer.android.com/reference/android/util/AttributeSet#getAttributeResourceValue(java.lang.String,%20java.lang.String,%20int))`(`[String](https://developer.android.com/reference/java/lang/String)` namespace, `[String](https://developer.android.com/reference/java/lang/String)` attribute, int defaultValue) ` Return the value of 'attribute' as a resource identifier.                                                                                                         |
| ` abstract int`                                                                | ` `[getAttributeResourceValue](https://developer.android.com/reference/android/util/AttributeSet#getAttributeResourceValue(int,%20int))`(int index, int defaultValue) ` Return the value of attribute at 'index' as a resource identifier.                                                                                                                                                                                                                                                                                      |
| ` abstract int`                                                                | ` `[getAttributeUnsignedIntValue](https://developer.android.com/reference/android/util/AttributeSet#getAttributeUnsignedIntValue(java.lang.String,%20java.lang.String,%20int))`(`[String](https://developer.android.com/reference/java/lang/String)` namespace, `[String](https://developer.android.com/reference/java/lang/String)` attribute, int defaultValue) ` Return the boolean value of 'attribute' that is formatted as an unsigned value.                                                                             |
| ` abstract int`                                                                | ` `[getAttributeUnsignedIntValue](https://developer.android.com/reference/android/util/AttributeSet#getAttributeUnsignedIntValue(int,%20int))`(int index, int defaultValue) ` Return the integer value of attribute at 'index' that is formatted as an unsigned value.                                                                                                                                                                                                                                                          |
| ` abstract `[String](https://developer.android.com/reference/java/lang/String) | ` `[getAttributeValue](https://developer.android.com/reference/android/util/AttributeSet#getAttributeValue(int))`(int index) ` Returns the value of the specified attribute as a string representation.                                                                                                                                                                                                                                                                                                                         |
| ` abstract `[String](https://developer.android.com/reference/java/lang/String) | ` `[getAttributeValue](https://developer.android.com/reference/android/util/AttributeSet#getAttributeValue(java.lang.String,%20java.lang.String))`(`[String](https://developer.android.com/reference/java/lang/String)` namespace, `[String](https://developer.android.com/reference/java/lang/String)` name) ` Returns the value of the specified attribute as a string representation.                                                                                                                                        |
| ` abstract `[String](https://developer.android.com/reference/java/lang/String) | ` `[getClassAttribute](https://developer.android.com/reference/android/util/AttributeSet#getClassAttribute())`() ` Return the value of the "class" attribute or null if there is not one.                                                                                                                                                                                                                                                                                                                                       |
| ` abstract `[String](https://developer.android.com/reference/java/lang/String) | ` `[getIdAttribute](https://developer.android.com/reference/android/util/AttributeSet#getIdAttribute())`() ` Return the value of the "id" attribute or null if there is not one.                                                                                                                                                                                                                                                                                                                                                |
| ` abstract int`                                                                | ` `[getIdAttributeResourceValue](https://developer.android.com/reference/android/util/AttributeSet#getIdAttributeResourceValue(int))`(int defaultValue) ` Return the integer value of the "id" attribute or defaultValue if there is none.                                                                                                                                                                                                                                                                                      |
| ` abstract `[String](https://developer.android.com/reference/java/lang/String) | ` `[getPositionDescription](https://developer.android.com/reference/android/util/AttributeSet#getPositionDescription())`() ` Returns a description of the current position of the attribute set.                                                                                                                                                                                                                                                                                                                                |
| ` abstract int`                                                                | ` `[getStyleAttribute](https://developer.android.com/reference/android/util/AttributeSet#getStyleAttribute())`() ` Return the value of the "style" attribute or 0 if there is not one.                                                                                                                                                                                                                                                                                                                                          |

## Public methods

### getAttributeBooleanValue

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public abstract boolean getAttributeBooleanValue (String namespace, 
                String attribute, 
                boolean defaultValue)
```

Return the boolean value of 'attribute'.

<br />

|                                   Parameters                                   ||
|----------------|----------------------------------------------------------------|
| `namespace`    | `String`: Namespace of attribute to retrieve. <br />           |
| `attribute`    | `String`: The attribute to retrieve. <br />                    |
| `defaultValue` | `boolean`: What to return if the attribute isn't found. <br /> |

|              Returns               ||
|-----------|-------------------------|
| `boolean` | Resulting value. <br /> |

### getAttributeBooleanValue

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public abstract boolean getAttributeBooleanValue (int index, 
                boolean defaultValue)
```

Return the boolean value of attribute at 'index'.

<br />

|                                   Parameters                                   ||
|----------------|----------------------------------------------------------------|
| `index`        | `int`: Index of the desired attribute, 0...count-1. <br />     |
| `defaultValue` | `boolean`: What to return if the attribute isn't found. <br /> |

|              Returns               ||
|-----------|-------------------------|
| `boolean` | Resulting value. <br /> |

### getAttributeCount

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public abstract int getAttributeCount ()
```

Returns the number of attributes available in the set.

See also[XmlPullParser.getAttributeCount()](https://developer.android.com/reference/org/xmlpull/v1/XmlPullParser#getAttributeCount()), which this method corresponds to when parsing a compiled XML file.

<br />

<br />

|                           Returns                           ||
|-------|------------------------------------------------------|
| `int` | A positive integer, or 0 if the set is empty. <br /> |

### getAttributeFloatValue

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public abstract float getAttributeFloatValue (int index, 
                float defaultValue)
```

Return the float value of attribute at 'index'.

<br />

|                                  Parameters                                  ||
|----------------|--------------------------------------------------------------|
| `index`        | `int`: Index of the desired attribute, 0...count-1. <br />   |
| `defaultValue` | `float`: What to return if the attribute isn't found. <br /> |

|             Returns              ||
|---------|-------------------------|
| `float` | Resulting value. <br /> |

### getAttributeFloatValue

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public abstract float getAttributeFloatValue (String namespace, 
                String attribute, 
                float defaultValue)
```

Return the float value of 'attribute'.

<br />

|                                  Parameters                                  ||
|----------------|--------------------------------------------------------------|
| `namespace`    | `String`: Namespace of attribute to retrieve. <br />         |
| `attribute`    | `String`: The attribute to retrieve. <br />                  |
| `defaultValue` | `float`: What to return if the attribute isn't found. <br /> |

|             Returns              ||
|---------|-------------------------|
| `float` | Resulting value. <br /> |

### getAttributeIntValue

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public abstract int getAttributeIntValue (String namespace, 
                String attribute, 
                int defaultValue)
```

Return the integer value of 'attribute'.

<br />

|                                 Parameters                                 ||
|----------------|------------------------------------------------------------|
| `namespace`    | `String`: Namespace of attribute to retrieve. <br />       |
| `attribute`    | `String`: The attribute to retrieve. <br />                |
| `defaultValue` | `int`: What to return if the attribute isn't found. <br /> |

|            Returns             ||
|-------|-------------------------|
| `int` | Resulting value. <br /> |

### getAttributeIntValue

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public abstract int getAttributeIntValue (int index, 
                int defaultValue)
```

Return the integer value of attribute at 'index'.

<br />

|                                 Parameters                                 ||
|----------------|------------------------------------------------------------|
| `index`        | `int`: Index of the desired attribute, 0...count-1. <br /> |
| `defaultValue` | `int`: What to return if the attribute isn't found. <br /> |

|            Returns             ||
|-------|-------------------------|
| `int` | Resulting value. <br /> |

### getAttributeListValue

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public abstract int getAttributeListValue (int index, 
                String[] options, 
                int defaultValue)
```

Return the index of the value of attribute at 'index' in the list 'options'.

<br />

|                                          Parameters                                           ||
|----------------|-------------------------------------------------------------------------------|
| `index`        | `int`: Index of the desired attribute, 0...count-1. <br />                    |
| `options`      | `String`: List of strings whose values we are checking against. <br />        |
| `defaultValue` | `int`: Value returned if attribute doesn't exist or no match is found. <br /> |

|                       Returns                        ||
|-------|-----------------------------------------------|
| `int` | Index in to 'options' or defaultValue. <br /> |

### getAttributeListValue

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public abstract int getAttributeListValue (String namespace, 
                String attribute, 
                String[] options, 
                int defaultValue)
```

Return the index of the value of 'attribute' in the list 'options'.

<br />

|                                          Parameters                                           ||
|----------------|-------------------------------------------------------------------------------|
| `namespace`    | `String`: Namespace of attribute to retrieve. <br />                          |
| `attribute`    | `String`: Name of attribute to retrieve. <br />                               |
| `options`      | `String`: List of strings whose values we are checking against. <br />        |
| `defaultValue` | `int`: Value returned if attribute doesn't exist or no match is found. <br /> |

|                       Returns                        ||
|-------|-----------------------------------------------|
| `int` | Index in to 'options' or defaultValue. <br /> |

### getAttributeName

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public abstract String getAttributeName (int index)
```

Returns the name of the specified attribute.

See also[XmlPullParser.getAttributeName()](https://developer.android.com/reference/org/xmlpull/v1/XmlPullParser#getAttributeName(int)), which this method corresponds to when parsing a compiled XML file.

<br />

<br />

|                             Parameters                              ||
|---------|------------------------------------------------------------|
| `index` | `int`: Index of the desired attribute, 0...count-1. <br /> |

|                                                                               Returns                                                                               ||
|--------------------------------------------------------------------|-------------------------------------------------------------------------------------------------|
| [String](https://developer.android.com/reference/java/lang/String) | A String containing the name of the attribute, or null if the attribute cannot be found. <br /> |

### getAttributeNameResource

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public abstract int getAttributeNameResource (int index)
```

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[getAttributeResourceValue(int, int)](https://developer.android.com/reference/android/util/AttributeSet#getAttributeResourceValue(int,%20int))in that it returns a resource identifier for the attribute name; the other method returns this attribute's value as a resource identifier.

<br />

|                             Parameters                              ||
|---------|------------------------------------------------------------|
| `index` | `int`: Index of the desired attribute, 0...count-1. <br /> |

|                      Returns                      ||
|-------|--------------------------------------------|
| `int` | The resource identifier, 0 if none. <br /> |

### getAttributeNamespace

Added in[API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public String getAttributeNamespace (int index)
```

Returns the namespace of the specified attribute.

See also[XmlPullParser.getAttributeNamespace()](https://developer.android.com/reference/org/xmlpull/v1/XmlPullParser#getAttributeNamespace(int)), which this method corresponds to when parsing a compiled XML file.

<br />

<br />

|                             Parameters                              ||
|---------|------------------------------------------------------------|
| `index` | `int`: Index of the desired attribute, 0...count-1. <br /> |

|                                                                                 Returns                                                                                 ||
|--------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------|
| [String](https://developer.android.com/reference/java/lang/String) | A String containing the namespace of the attribute, or null if th attribute cannot be found. <br /> |

### getAttributeResourceValue

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public abstract int getAttributeResourceValue (String namespace, 
                String attribute, 
                int defaultValue)
```

Return the value of 'attribute' as a resource identifier.

Note that this is different than[getAttributeNameResource(int)](https://developer.android.com/reference/android/util/AttributeSet#getAttributeNameResource(int))in that it returns 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.

<br />

|                                 Parameters                                 ||
|----------------|------------------------------------------------------------|
| `namespace`    | `String`: Namespace of attribute to retrieve. <br />       |
| `attribute`    | `String`: The attribute to retrieve. <br />                |
| `defaultValue` | `int`: What to return if the attribute isn't found. <br /> |

|            Returns             ||
|-------|-------------------------|
| `int` | Resulting value. <br /> |

### getAttributeResourceValue

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public abstract int getAttributeResourceValue (int index, 
                int defaultValue)
```

Return the value of attribute at 'index' as a resource identifier.

Note that this is different than[getAttributeNameResource(int)](https://developer.android.com/reference/android/util/AttributeSet#getAttributeNameResource(int))in that it returns 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.

<br />

|                                 Parameters                                 ||
|----------------|------------------------------------------------------------|
| `index`        | `int`: Index of the desired attribute, 0...count-1. <br /> |
| `defaultValue` | `int`: What to return if the attribute isn't found. <br /> |

|            Returns             ||
|-------|-------------------------|
| `int` | Resulting value. <br /> |

### getAttributeUnsignedIntValue

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public abstract int getAttributeUnsignedIntValue (String namespace, 
                String attribute, 
                int defaultValue)
```

Return the boolean value of 'attribute' that is formatted as an unsigned value. In particular, the formats 0xn...n and #n...n are handled.

<br />

|                                 Parameters                                 ||
|----------------|------------------------------------------------------------|
| `namespace`    | `String`: Namespace of attribute to retrieve. <br />       |
| `attribute`    | `String`: The attribute to retrieve. <br />                |
| `defaultValue` | `int`: What to return if the attribute isn't found. <br /> |

|            Returns             ||
|-------|-------------------------|
| `int` | Resulting value. <br /> |

### getAttributeUnsignedIntValue

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public abstract int getAttributeUnsignedIntValue (int index, 
                int defaultValue)
```

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.

<br />

|                                 Parameters                                 ||
|----------------|------------------------------------------------------------|
| `index`        | `int`: Index of the desired attribute, 0...count-1. <br /> |
| `defaultValue` | `int`: What to return if the attribute isn't found. <br /> |

|            Returns             ||
|-------|-------------------------|
| `int` | Resulting value. <br /> |

### getAttributeValue

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public abstract String getAttributeValue (int index)
```

Returns the value of the specified attribute as a string representation.

<br />

|                             Parameters                              ||
|---------|------------------------------------------------------------|
| `index` | `int`: Index of the desired attribute, 0...count-1. <br /> |

|                                                                               Returns                                                                                ||
|--------------------------------------------------------------------|--------------------------------------------------------------------------------------------------|
| [String](https://developer.android.com/reference/java/lang/String) | A String containing the value of the attribute, or null if the attribute cannot be found. <br /> |

### getAttributeValue

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public abstract String getAttributeValue (String namespace, 
                String name)
```

Returns the value of the specified attribute as a string representation. The lookup is performed using the attribute name.

<br />

|                                     Parameters                                      ||
|-------------|------------------------------------------------------------------------|
| `namespace` | `String`: The namespace of the attribute to get the value from. <br /> |
| `name`      | `String`: The name of the attribute to get the value from. <br />      |

|                                                                               Returns                                                                                ||
|--------------------------------------------------------------------|--------------------------------------------------------------------------------------------------|
| [String](https://developer.android.com/reference/java/lang/String) | A String containing the value of the attribute, or null if the attribute cannot be found. <br /> |

### getClassAttribute

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public abstract String getClassAttribute ()
```

Return the value of the "class" attribute or null if there is not one. Equivalent to getAttributeValue(null, "class").

<br />

|                                                     Returns                                                     ||
|--------------------------------------------------------------------|---------------------------------------------|
| [String](https://developer.android.com/reference/java/lang/String) | The class attribute's value or null. <br /> |

### getIdAttribute

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public abstract String getIdAttribute ()
```

Return the value of the "id" attribute or null if there is not one. Equivalent to getAttributeValue(null, "id").

<br />

|                                                   Returns                                                    ||
|--------------------------------------------------------------------|------------------------------------------|
| [String](https://developer.android.com/reference/java/lang/String) | The id attribute's value or null. <br /> |

### getIdAttributeResourceValue

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public abstract int getIdAttributeResourceValue (int defaultValue)
```

Return the integer value of the "id" attribute or defaultValue if there is none. Equivalent to getAttributeResourceValue(null, "id", defaultValue);

<br />

|                                   Parameters                                    ||
|----------------|-----------------------------------------------------------------|
| `defaultValue` | `int`: What to return if the "id" attribute isn't found. <br /> |

|              Returns               ||
|-------|-----------------------------|
| `int` | int Resulting value. <br /> |

### getPositionDescription

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public abstract String getPositionDescription ()
```

Returns a description of the current position of the attribute set. For instance, if the attribute set is loaded from an XML document, the position description could indicate the current line number.

<br />

|                                                                       Returns                                                                       ||
|--------------------------------------------------------------------|---------------------------------------------------------------------------------|
| [String](https://developer.android.com/reference/java/lang/String) | A string representation of the current position in the set, may be null. <br /> |

### getStyleAttribute

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public abstract int getStyleAttribute ()
```

Return the value of the "style" attribute or 0 if there is not one. Equivalent to getAttributeResourceValue(null, "style").

<br />

|                            Returns                            ||
|-------|--------------------------------------------------------|
| `int` | The style attribute's resource identifier or 0. <br /> |