# HeaderItem

# HeaderItem

Artifact:[androidx.leanback:leanback](https://developer.android.com/jetpack/androidx/releases/leanback)  
[View Source](https://cs.android.com/search?q=file:androidx/leanback/widget/HeaderItem.java+class:androidx.leanback.widget.HeaderItem)  
Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/leanback#1.1.0)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/leanback/widget/HeaderItem "View this page in Java")

<br />

```
class HeaderItem
```

<br />

*** ** * ** ***

A header item describes the metadata of a[Row](https://developer.android.com/reference/kotlin/androidx/leanback/widget/Row), such as a category of media items. May be subclassed to add more information.

## Summary

|                                                                                                                                                           ### Public constructors                                                                                                                                                           |
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [HeaderItem](https://developer.android.com/reference/kotlin/androidx/leanback/widget/HeaderItem#HeaderItem(java.lang.String))`(name: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!)` Create a header item.                                                                                           |
| [HeaderItem](https://developer.android.com/reference/kotlin/androidx/leanback/widget/HeaderItem#HeaderItem(long,java.lang.String))`(id: `[Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)`, name: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!)` Create a header item. |

|                                       ### Public functions                                        |
|---------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [CharSequence](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html)`!` | [getContentDescription](https://developer.android.com/reference/kotlin/androidx/leanback/widget/HeaderItem#getContentDescription())`()` Returns optional content description for the HeaderItem.                                                                                                                                         |
| [CharSequence](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html)`!` | [getDescription](https://developer.android.com/reference/kotlin/androidx/leanback/widget/HeaderItem#getDescription())`()` Returns the description for the current row.                                                                                                                                                                   |
| [Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)                     | [getId](https://developer.android.com/reference/kotlin/androidx/leanback/widget/HeaderItem#getId())`()` Returns a unique identifier for this item.                                                                                                                                                                                       |
| [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!`              | [getName](https://developer.android.com/reference/kotlin/androidx/leanback/widget/HeaderItem#getName())`()` Returns the name of this header item.                                                                                                                                                                                        |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                     | [setContentDescription](https://developer.android.com/reference/kotlin/androidx/leanback/widget/HeaderItem#setContentDescription(java.lang.CharSequence))`(contentDescription: `[CharSequence](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html)`!)` Sets optional content description for the HeaderItem. |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                     | [setDescription](https://developer.android.com/reference/kotlin/androidx/leanback/widget/HeaderItem#setDescription(java.lang.CharSequence))`(description: `[CharSequence](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html)`!)` Sets the description for the current header item.                          |

## Public constructors

### HeaderItem

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/leanback#1.1.0)  

```
HeaderItem(name: String!)
```

Create a header item.  

### HeaderItem

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/leanback#1.1.0)  

```
HeaderItem(id: Long, name: String!)
```

Create a header item. All fields are optional.  

## Public functions

### getContentDescription

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/leanback#1.1.0)  

```
fun getContentDescription(): CharSequence!
```

Returns optional content description for the HeaderItem. When it is null,[getName](https://developer.android.com/reference/kotlin/androidx/leanback/widget/HeaderItem#getName())should be used for the content description.  

|                                              Returns                                              |
|---------------------------------------------------------------------------------------------------|-----------------------------------------|
| [CharSequence](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html)`!` | Content description for the HeaderItem. |

### getDescription

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/leanback#1.1.0)  

```
fun getDescription(): CharSequence!
```

Returns the description for the current row.  

### getId

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/leanback#1.1.0)  

```
fun getId(): Long
```

Returns a unique identifier for this item.  

### getName

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/leanback#1.1.0)  

```
fun getName(): String!
```

Returns the name of this header item.  

### setContentDescription

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/leanback#1.1.0)  

```
fun setContentDescription(contentDescription: CharSequence!): Unit
```

Sets optional content description for the HeaderItem.  

|                                                       Parameters                                                        |
|-------------------------------------------------------------------------------------------------------------------------|---------------------------------------------|
| `contentDescription: `[CharSequence](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html)`!` | Content description sets on the HeaderItem. |

### setDescription

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/leanback#1.1.0)  

```
fun setDescription(description: CharSequence!): Unit
```

Sets the description for the current header item. This will be visible when the row receives focus.