Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Methods](https://developer.android.com/reference/android/window/OnBackAnimationCallback#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/window/OnBackAnimationCallback#inhmethods)

# OnBackAnimationCallback

*** ** * ** ***

` public interface OnBackAnimationCallback `   
` implements https://developer.android.com/reference/android/window/OnBackInvokedCallback `

|---|
| android.window.OnBackAnimationCallback |

<br />

*** ** * ** ***

Interface for applications to register back animation callbacks along their custom back handling.

This allows the client to customize various back behaviors by overriding the corresponding callback methods.

Callback instances can be added to and removed from `https://developer.android.com/reference/android/window/OnBackInvokedDispatcher`, which is held at window level and accessible through `https://developer.android.com/reference/android/app/Activity#getOnBackInvokedDispatcher()`, `https://developer.android.com/reference/android/app/Dialog#getOnBackInvokedDispatcher()`, `https://developer.android.com/reference/android/view/Window#getOnBackInvokedDispatcher()` and `https://developer.android.com/reference/android/view/View#findOnBackInvokedDispatcher()`.

When back is triggered, callbacks on the in-focus window are invoked in reverse order in which they are added within the same priority. Between different priorities, callbacks with higher priority are invoked first.

<br />

**See also:**

- `https://developer.android.com/reference/android/window/OnBackInvokedCallback`

## Summary

| ### Public methods ||
|---|---|
| ` default void` | ` https://developer.android.com/reference/android/window/OnBackAnimationCallback#onBackCancelled()() ` Called when a back gesture or back button press has been cancelled. |
| ` default void` | ` https://developer.android.com/reference/android/window/OnBackAnimationCallback#onBackProgressed(android.window.BackEvent)(https://developer.android.com/reference/android/window/BackEvent backEvent) ` Called when a back gesture progresses. |
| ` default void` | ` https://developer.android.com/reference/android/window/OnBackAnimationCallback#onBackStarted(android.window.BackEvent)(https://developer.android.com/reference/android/window/BackEvent backEvent) ` Called when a back gesture has been started, or back button has been pressed down. |

### Inherited methods

From interface ` https://developer.android.com/reference/android/window/OnBackInvokedCallback ` ` abstract void` ` https://developer.android.com/reference/android/window/OnBackInvokedCallback#onBackInvoked()() `

Called when a back gesture has been completed and committed, or back button pressed has been released and committed.

## Public methods

### onBackCancelled

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void onBackCancelled ()
```

Called when a back gesture or back button press has been cancelled.

<br />

### onBackProgressed

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void onBackProgressed (BackEvent backEvent)
```

Called when a back gesture progresses.

<br />

| Parameters ||
|---|---|
| `backEvent` | `BackEvent`: An `https://developer.android.com/reference/android/window/BackEvent` object describing the progress event. This value cannot be `null`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/window/BackEvent`

### onBackStarted

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void onBackStarted (BackEvent backEvent)
```

Called when a back gesture has been started, or back button has been pressed down.

<br />

| Parameters ||
|---|---|
| `backEvent` | `BackEvent`: The `https://developer.android.com/reference/android/window/BackEvent` containing information about the touch or button press. This value cannot be `null`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/window/BackEvent`