# ConstraintsChangedListener

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

*** ** * ** ***


```
public abstract class ConstraintsChangedListener
```

<br />

*** ** * ** ***

**Added in 2.0**

Callbacks on state change

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintsChangedListener#ConstraintsChangedListener()()` |

| ### Public methods |
|---|---|
| `void` | `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintsChangedListener#postLayoutChange(int,int)(int stateId, int constraintId)` called after layout happens |
| `void` | `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintsChangedListener#preLayoutChange(int,int)(int stateId, int constraintId)` called before layout happens |

## Public constructors

### ConstraintsChangedListener

Added in 2.2.2

```
public ConstraintsChangedListener()
```

## Public methods

### postLayoutChange

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

```
public void postLayoutChange(int stateId, int constraintId)
```

called after layout happens

| Parameters |
|---|---|
| `int stateId` | -1 if state unknown, otherwise the current state |
| `int constraintId` | the current constraintSet id we transitioned to |

### preLayoutChange

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

```
public void preLayoutChange(int stateId, int constraintId)
```

called before layout happens

| Parameters |
|---|---|
| `int stateId` | -1 if state unknown, otherwise the state we will transition to |
| `int constraintId` | the constraintSet id that we will transition to |