# PoolingContainerListener

# PoolingContainerListener

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+class:androidx.customview.poolingcontainer.PoolingContainerListener)  
Added in[1.0.0](https://developer.android.com/jetpack/androidx/releases/customview#1.0.0)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/customview/poolingcontainer/PoolingContainerListener "View this page in Java")

<br />

```
fun interface PoolingContainerListener
```

<br />

*** ** * ** ***

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.

This callback is not necessarily triggered if the pooling container is disassociating the View from a particular piece of data (that is, it is*not*an "unbind listener"). It is intended for expensive resources that need to be cached across data items, but need a signal to be disposed of.

## Summary

|                             ### Public functions                              |
|-------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | `@`[UiThread](https://developer.android.com/reference/kotlin/androidx/annotation/UiThread) [onRelease](https://developer.android.com/reference/kotlin/androidx/customview/poolingcontainer/PoolingContainerListener#onRelease())`()` Signals that this view should dispose any resources it may be holding onto, because its container is either discarding the View or has been removed from the hierarchy itself. |

## Public functions

### onRelease

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

```
@UiThread
fun onRelease(): Unit
```

Signals that this view should dispose any resources it may be holding onto, because its container is either discarding the View or has been removed from the hierarchy itself.

Note: This may be called multiple times. A call to this method does*not*mean the View will not later be reattached.