# TabTemplate.TabCallback

# TabTemplate.TabCallback

Artifact:[androidx.car.app:app](https://developer.android.com/jetpack/androidx/releases/car-app)  
[View Source](https://cs.android.com/search?q=file:androidx/car/app/model/TabTemplate.java+class:androidx.car.app.model.TabTemplate.TabCallback)  
Added in[1.3.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.3.0)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/car/app/model/TabTemplate.TabCallback "View this page in Java")

<br />

```
interface TabTemplate.TabCallback
```

<br />

*** ** * ** ***

A listener for tab selection.

## Summary

|                             ### Public functions                              |
|-------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [onTabSelected](https://developer.android.com/reference/kotlin/androidx/car/app/model/TabTemplate.TabCallback#onTabSelected(java.lang.String))`(tabContentId: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`)` Notifies the selected`Tab`has changed. |

## Public functions

### onTabSelected

Added in[1.3.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.3.0)  

```
fun onTabSelected(tabContentId: String): Unit
```

Notifies the selected`Tab`has changed.

The host invokes this callback as the user selects a tab.  

|                                            Parameters                                             |
|---------------------------------------------------------------------------------------------------|-------------------------------------|
| `tabContentId: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html) | the content ID of the selected tab. |