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

# BackEvent

*** ** * ** ***

` public final class BackEvent `   
` extends https://developer.android.com/reference/java/lang/Object ` ` `

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.window.BackEvent |

<br />

*** ** * ** ***

Object used to report back gesture progress. Holds information about the touch event, swipe direction and the animation progress that predictive back animations should seek to.

## Summary

| ### Constants ||
|---|---|
| `int` | `https://developer.android.com/reference/android/window/BackEvent#EDGE_LEFT` Indicates that the edge swipe starts from the left edge of the screen |
| `int` | `https://developer.android.com/reference/android/window/BackEvent#EDGE_NONE` Indicates that the back event was not triggered by an edge swipe back gesture. |
| `int` | `https://developer.android.com/reference/android/window/BackEvent#EDGE_RIGHT` Indicates that the edge swipe starts from the right edge of the screen |

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/window/BackEvent#BackEvent(float,%20float,%20float,%20int)(float touchX, float touchY, float progress, int swipeEdge) ` Creates a new `https://developer.android.com/reference/android/window/BackEvent` instance with a frame time of 0. |
| ` https://developer.android.com/reference/android/window/BackEvent#BackEvent(float,%20float,%20float,%20int,%20long)(float touchX, float touchY, float progress, int swipeEdge, long frameTimeMillis) ` Creates a new `https://developer.android.com/reference/android/window/BackEvent` instance. |

| ### Public methods ||
|---|---|
| ` boolean` | ` https://developer.android.com/reference/android/window/BackEvent#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object other) ` Indicates whether some other object is "equal to" this one. |
| ` long` | ` https://developer.android.com/reference/android/window/BackEvent#getFrameTimeMillis()() ` Returns the frameTime of the BackEvent in milliseconds. |
| ` float` | ` https://developer.android.com/reference/android/window/BackEvent#getProgress()() ` Returns a value between 0 and 1 on how far along the back gesture is. |
| ` int` | ` https://developer.android.com/reference/android/window/BackEvent#getSwipeEdge()() ` Returns the screen edge that the swipe starts from. |
| ` float` | ` https://developer.android.com/reference/android/window/BackEvent#getTouchX()() ` Returns the absolute X location of the touch point, or NaN if the event is from a button press. |
| ` float` | ` https://developer.android.com/reference/android/window/BackEvent#getTouchY()() ` Returns the absolute Y location of the touch point, or NaN if the event is from a button press. |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/window/BackEvent#toString()() ` Returns a string representation of the object. |

### Inherited methods

From class ` https://developer.android.com/reference/java/lang/Object ` ` https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/java/lang/Object#clone()() `

Creates and returns a copy of this object.
` boolean` ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) `

Indicates whether some other object is "equal to" this one.
` void` ` https://developer.android.com/reference/java/lang/Object#finalize()() `

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
` final https://developer.android.com/reference/java/lang/Class<?>` ` https://developer.android.com/reference/java/lang/Object#getClass()() `

Returns the runtime class of this `Object`.
` int` ` https://developer.android.com/reference/java/lang/Object#hashCode()() `

Returns a hash code value for the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#notify()() `

Wakes up a single thread that is waiting on this object's monitor.
` final void` ` https://developer.android.com/reference/java/lang/Object#notifyAll()() `

Wakes up all threads that are waiting on this object's monitor.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/lang/Object#toString()() `

Returns a string representation of the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait()() `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*.

## Constants

### EDGE_LEFT

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

```
public static final int EDGE_LEFT
```

Indicates that the edge swipe starts from the left edge of the screen

<br />

Constant Value: 0 (0x00000000)

### EDGE_NONE

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

```
public static final int EDGE_NONE
```

Indicates that the back event was not triggered by an edge swipe back gesture. This applies to cases like using the back button in 3-button navigation or pressing a hardware back button.

<br />

Constant Value: 2 (0x00000002)

### EDGE_RIGHT

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

```
public static final int EDGE_RIGHT
```

Indicates that the edge swipe starts from the right edge of the screen

<br />

Constant Value: 1 (0x00000001)

## Public constructors

### BackEvent

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

```
public BackEvent (float touchX, 
                float touchY, 
                float progress, 
                int swipeEdge)
```

Creates a new `https://developer.android.com/reference/android/window/BackEvent` instance with a frame time of 0.

<br />

| Parameters ||
|---|---|
| `touchX` | `float`: Absolute X location of the touch point of this event. <br /> |
| `touchY` | `float`: Absolute Y location of the touch point of this event. <br /> |
| `progress` | `float`: Value between 0 and 1 on how far along the back gesture is. <br /> |
| `swipeEdge` | `int`: Indicates which edge the swipe starts from. Value is one of the following: - `https://developer.android.com/reference/android/window/BackEvent#EDGE_LEFT` - `https://developer.android.com/reference/android/window/BackEvent#EDGE_RIGHT` - `https://developer.android.com/reference/android/window/BackEvent#EDGE_NONE` |

### BackEvent

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

```
public BackEvent (float touchX, 
                float touchY, 
                float progress, 
                int swipeEdge, 
                long frameTimeMillis)
```

Creates a new `https://developer.android.com/reference/android/window/BackEvent` instance.

<br />

| Parameters ||
|---|---|
| `touchX` | `float`: Absolute X location of the touch point of this event. <br /> |
| `touchY` | `float`: Absolute Y location of the touch point of this event. <br /> |
| `progress` | `float`: Value between 0 and 1 on how far along the back gesture is. <br /> |
| `swipeEdge` | `int`: Indicates which edge the swipe starts from. Value is one of the following: - `https://developer.android.com/reference/android/window/BackEvent#EDGE_LEFT` - `https://developer.android.com/reference/android/window/BackEvent#EDGE_RIGHT` - `https://developer.android.com/reference/android/window/BackEvent#EDGE_NONE` |
| `frameTimeMillis` | `long`: frame time of the back event. <br /> |

## Public methods

### equals

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

```
public boolean equals (Object other)
```

Indicates whether some other object is "equal to" this one.

The `equals` method implements an equivalence relation on non-null object references:

- It is *reflexive*: for any non-null reference value `x`, `x.equals(x)` should return `true`.
- It is *symmetric*: for any non-null reference values `x` and `y`, `x.equals(y)` should return `true` if and only if `y.equals(x)` returns `true`.
- It is *transitive*: for any non-null reference values `x`, `y`, and `z`, if `x.equals(y)` returns `true` and `y.equals(z)` returns `true`, then `x.equals(z)` should return `true`.
- It is *consistent*: for any non-null reference values `x` and `y`, multiple invocations of `x.equals(y)` consistently return `true` or consistently return `false`, provided no information used in `equals` comparisons on the objects is modified.
- For any non-null reference value `x`, `x.equals(null)` should return `false`.

An equivalence relation partitions the elements it operates on into *equivalence classes*; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

<br />

| Parameters ||
|---|---|
| `other` | `Object`: the reference object with which to compare. <br /> |

| Returns ||
|---|---|
| `boolean` | `true` if this object is the same as the obj argument; `false` otherwise. <br /> |

### getFrameTimeMillis

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

```
public long getFrameTimeMillis ()
```

Returns the frameTime of the BackEvent in milliseconds. Useful for calculating velocity.

<br />

| Returns ||
|---|---|
| `long` | <br /> |

### getProgress

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

```
public float getProgress ()
```

Returns a value between 0 and 1 on how far along the back gesture is. This value is driven by the horizontal location of the touch point, and should be used as the fraction to seek the predictive back animation with. Specifically,

1. The progress is 0 when the touch is at the starting edge of the screen (left or right), and animation should seek to its start state.
2. The progress is approximately 1 when the touch is at the opposite side of the screen, and animation should seek to its end state. Exact end value may vary depending on screen size.

- After the gesture finishes in cancel state, this method keeps getting invoked until the progress value animates back to 0. In-between locations are linearly interpolated based on horizontal distance from the starting edge and smooth clamped to 1 when the distance exceeds a system-wide threshold.<br />

  <br />

  | Returns ||
  |---|---|
  | `float` | Value is between 0.0f and 1.0f inclusive <br /> |

### getSwipeEdge

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

```
public int getSwipeEdge ()
```

Returns the screen edge that the swipe starts from.

<br />

| Returns ||
|---|---|
| `int` | Value is one of the following: - `https://developer.android.com/reference/android/window/BackEvent#EDGE_LEFT` - `https://developer.android.com/reference/android/window/BackEvent#EDGE_RIGHT` - `https://developer.android.com/reference/android/window/BackEvent#EDGE_NONE` |

### getTouchX

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

```
public float getTouchX ()
```

Returns the absolute X location of the touch point, or NaN if the event is from a button press.

<br />

| Returns ||
|---|---|
| `float` | <br /> |

### getTouchY

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

```
public float getTouchY ()
```

Returns the absolute Y location of the touch point, or NaN if the event is from a button press.

<br />

| Returns ||
|---|---|
| `float` | <br /> |

### toString

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

```
public String toString ()
```

Returns a string representation of the object.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | a string representation of the object. <br /> |