# DataSource.InvalidatedCallback

# DataSource.InvalidatedCallback

Artifact:[androidx.paging:paging-common](https://developer.android.com/jetpack/androidx/releases/paging)  
[View Source](https://cs.android.com/search?q=file:androidx/paging/DataSource.jvm.kt+class:androidx.paging.DataSource.InvalidatedCallback)  
Added in[2.0.0](https://developer.android.com/jetpack/androidx/releases/paging#2.0.0)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/paging/DataSource.InvalidatedCallback "View this page in Java")
Common/AllAndroid/JVMNative/C/iOSJavaScript
  - android  

  ```
  fun interface DataSource.InvalidatedCallback
  ```

*** ** * ** ***

Invalidation callback for[DataSource](https://developer.android.com/reference/kotlin/androidx/paging/DataSource).

Used to signal when a[DataSource](https://developer.android.com/reference/kotlin/androidx/paging/DataSource)a data source has become invalid, and that a new data source is needed to continue loading data.

## Summary

|                             ### Public functions                              |
|-------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------|
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | `@`[AnyThread](https://developer.android.com/reference/kotlin/androidx/annotation/AnyThread) [onInvalidated](https://developer.android.com/reference/kotlin/androidx/paging/DataSource.InvalidatedCallback#onInvalidated())`()` Called when the data backing the list has become invalid. | android |

## Public functions

### onInvalidated

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

```
@AnyThread
fun onInvalidated(): Unit
```

Called when the data backing the list has become invalid. This callback is typically used to signal that a new data source is needed.

This callback will be invoked on the thread that calls[invalidate](https://developer.android.com/reference/kotlin/androidx/paging/DataSource#invalidate()). It is valid for the data source to invalidate itself during its load methods, or for an outside source to invalidate it.