# BackgroundThreadStateHandler.StateChangeListener

Artifact: [androidx.media3:media3-common](https://developer.android.com/jetpack/androidx/releases/media3) [View Source](https://cs.android.com/search?q=file:androidx/media3/common/util/BackgroundThreadStateHandler.java+class:androidx.media3.common.util.BackgroundThreadStateHandler.StateChangeListener)

*** ** * ** ***


```
public interface BackgroundThreadStateHandler.StateChangeListener<T extends Object>
```

<br />

*** ** * ** ***

An interface to handle changes to the state on the foreground thread.

| Parameters |
|---|---|
| `<T extends https://developer.android.com/reference/java/lang/Object.html>` | An immutable object representing the entire state. Must implement `https://developer.android.com/reference/java/lang/Object.html#equals(java.lang.Object)`. |

## Summary

| ### Public methods |
|---|---|
| `abstract void` | `https://developer.android.com/reference/androidx/media3/common/util/BackgroundThreadStateHandler.StateChangeListener#onStateChanged(T,T)(T oldState, T newState)` The state has changed. |

## Public methods

### onStateChanged

```
abstract void onStateChanged(T oldState, T newState)
```

The state has changed.

A typical usage of this method is to inform external listeners.

This method will be called on the foreground thread.

| Parameters |
|---|---|
| `T oldState` | The old state. |
| `T newState` | The new state. |