# Carousel.Adapter

Artifact: [androidx.constraintlayout:constraintlayout](https://developer.android.com/jetpack/androidx/releases/constraintlayout) [View Source](https://cs.android.com/search?q=file:androidx/constraintlayout/helper/widget/Carousel.java+class:androidx.constraintlayout.helper.widget.Carousel.Adapter) Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

*** ** * ** ***


```
interface Carousel.Adapter
```

<br />

*** ** * ** ***

Adapter for a Carousel

## Summary

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/helper/widget/Carousel.Adapter#count()()` Number of items you want to display in the Carousel |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/helper/widget/Carousel.Adapter#onNewItem(int)(index: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Callback when we reach a new index |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/helper/widget/Carousel.Adapter#populate(android.view.View,int)(view: https://developer.android.com/reference/android/view/View.html!, index: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Callback to populate the view for the given index |

## Public functions

### count

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

```
fun count(): Int
```

Number of items you want to display in the Carousel

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | number of items |

### onNewItem

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

```
fun onNewItem(index: Int): Unit
```

Callback when we reach a new index

| Parameters |
|---|---|
| `index: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` |   |

### populate

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

```
fun populate(view: View!, index: Int): Unit
```

Callback to populate the view for the given index

| Parameters |
|---|---|
| `view: https://developer.android.com/reference/android/view/View.html!` |   |
| `index: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` |   |