# androidx.customview.poolingcontainer

*** ** * ** ***

## Interfaces

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/customview/poolingcontainer/PoolingContainerListener` | A callback to inform a child View within a container that manages its children's lifecycle outside of the View hierarchy (such as a RecyclerView) when that child should dispose any resources it holds. |

## Extension functions summary

|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/android/view/View.html.https://developer.android.com/reference/kotlin/androidx/customview/poolingcontainer/package-summary#(android.view.View).addPoolingContainerListener(androidx.customview.poolingcontainer.PoolingContainerListener)(listener: https://developer.android.com/reference/kotlin/androidx/customview/poolingcontainer/PoolingContainerListener)` Add a callback for when this View should dispose its resources. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/android/view/View.html.https://developer.android.com/reference/kotlin/androidx/customview/poolingcontainer/package-summary#(android.view.View).callPoolingContainerOnRelease()()` Calls `https://developer.android.com/reference/kotlin/androidx/customview/poolingcontainer/PoolingContainerListener#onRelease()` on any `https://developer.android.com/reference/kotlin/androidx/customview/poolingcontainer/PoolingContainerListener`s attached to this View or any of its children. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/android/view/ViewGroup.html.https://developer.android.com/reference/kotlin/androidx/customview/poolingcontainer/package-summary#(android.view.ViewGroup).callPoolingContainerOnReleaseForChildren()()` Calls `https://developer.android.com/reference/kotlin/androidx/customview/poolingcontainer/PoolingContainerListener#onRelease()` on any `https://developer.android.com/reference/kotlin/androidx/customview/poolingcontainer/PoolingContainerListener`s attached to any of its children (not including the `ViewGroup` itself) |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/android/view/View.html.https://developer.android.com/reference/kotlin/androidx/customview/poolingcontainer/package-summary#(android.view.View).removePoolingContainerListener(androidx.customview.poolingcontainer.PoolingContainerListener)( listener: https://developer.android.com/reference/kotlin/androidx/customview/poolingcontainer/PoolingContainerListener )` Remove a callback that was previously added by `https://developer.android.com/reference/kotlin/androidx/customview/poolingcontainer/package-summary#(android.view.View).addPoolingContainerListener(androidx.customview.poolingcontainer.PoolingContainerListener)` |

## Extension properties summary

|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/android/view/View.html.https://developer.android.com/reference/kotlin/androidx/customview/poolingcontainer/package-summary#(android.view.View).isPoolingContainer()` Whether this View is a container that manages the lifecycle of its child Views. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/android/view/View.html.https://developer.android.com/reference/kotlin/androidx/customview/poolingcontainer/package-summary#(android.view.View).isWithinPoolingContainer()` Whether one of this View's ancestors has `isPoolingContainer` set to `true` |

## Extension functions

### View.addPoolingContainerListener

Artifact: [androidx.customview:customview-poolingcontainer](https://developer.android.com/jetpack/androidx/releases/customview) [View Source](https://cs.android.com/search?q=file:androidx/customview/poolingcontainer/PoolingContainer.kt+function:addPoolingContainerListener) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/customview#1.0.0)

```
fun View.addPoolingContainerListener(listener: PoolingContainerListener): Unit
```

Add a callback for when this View should dispose its resources.

| Parameters |
|---|---|
| `https://developer.android.com/reference/android/view/View.html` | the child view to receive callbacks regarding |
| `listener: https://developer.android.com/reference/kotlin/androidx/customview/poolingcontainer/PoolingContainerListener` | the listener that produces onRelease callbacks, triggering resource disposal |

### View.callPoolingContainerOnRelease

Artifact: [androidx.customview:customview-poolingcontainer](https://developer.android.com/jetpack/androidx/releases/customview) [View Source](https://cs.android.com/search?q=file:androidx/customview/poolingcontainer/PoolingContainer.kt+function:callPoolingContainerOnRelease) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/customview#1.0.0)

```
fun View.callPoolingContainerOnRelease(): Unit
```

Calls `https://developer.android.com/reference/kotlin/androidx/customview/poolingcontainer/PoolingContainerListener#onRelease()` on any `https://developer.android.com/reference/kotlin/androidx/customview/poolingcontainer/PoolingContainerListener`s attached to this View or any of its children.

At the point when this is called, the View should be detached from the window.

### ViewGroup.callPoolingContainerOnReleaseForChildren

Artifact: [androidx.customview:customview-poolingcontainer](https://developer.android.com/jetpack/androidx/releases/customview) [View Source](https://cs.android.com/search?q=file:androidx/customview/poolingcontainer/PoolingContainer.kt+function:callPoolingContainerOnReleaseForChildren) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/customview#1.0.0)

```
fun ViewGroup.callPoolingContainerOnReleaseForChildren(): Unit
```

Calls `https://developer.android.com/reference/kotlin/androidx/customview/poolingcontainer/PoolingContainerListener#onRelease()` on any `https://developer.android.com/reference/kotlin/androidx/customview/poolingcontainer/PoolingContainerListener`s attached to any of its children (not including the `ViewGroup` itself)

At the point when this is called, the View should be detached from the window.

### View.removePoolingContainerListener

Artifact: [androidx.customview:customview-poolingcontainer](https://developer.android.com/jetpack/androidx/releases/customview) [View Source](https://cs.android.com/search?q=file:androidx/customview/poolingcontainer/PoolingContainer.kt+function:removePoolingContainerListener) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/customview#1.0.0)

```
fun View.removePoolingContainerListener(
    listener: PoolingContainerListener
): Unit
```

Remove a callback that was previously added by `https://developer.android.com/reference/kotlin/androidx/customview/poolingcontainer/package-summary#(android.view.View).addPoolingContainerListener(androidx.customview.poolingcontainer.PoolingContainerListener)`

## Extension properties

### View.isPoolingContainer

Artifact: [androidx.customview:customview-poolingcontainer](https://developer.android.com/jetpack/androidx/releases/customview) [View Source](https://cs.android.com/search?q=file:androidx/customview/poolingcontainer/PoolingContainer.kt+symbol:isPoolingContainer) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/customview#1.0.0)

```
var View.isPoolingContainer: Boolean
```

Whether this View is a container that manages the lifecycle of its child Views.

Any View that sets this to `true` must call `https://developer.android.com/reference/kotlin/androidx/customview/poolingcontainer/package-summary#(android.view.View).callPoolingContainerOnRelease()` on child Views before they are discarded and may possibly not be used in the future. This includes when the view itself is detached from the window, unless it is being held for possible later reattachment and its children should not release their resources.

**Warning: Failure to call `https://developer.android.com/reference/kotlin/androidx/customview/poolingcontainer/package-summary#(android.view.View).callPoolingContainerOnRelease()` when a View is removed from the hierarchy and discarded is likely to result in memory leaks!**

### View.isWithinPoolingContainer

Artifact: [androidx.customview:customview-poolingcontainer](https://developer.android.com/jetpack/androidx/releases/customview) [View Source](https://cs.android.com/search?q=file:androidx/customview/poolingcontainer/PoolingContainer.kt+symbol:isWithinPoolingContainer) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/customview#1.0.0)

```
val View.isWithinPoolingContainer: Boolean
```

Whether one of this View's ancestors has `isPoolingContainer` set to `true`