# NavigationEvent

Artifact: [androidx.navigationevent:navigationevent](https://developer.android.com/jetpack/androidx/releases/navigationevent) [View Source](https://cs.android.com/search?q=file:androidx/navigationevent/NavigationEvent.kt+class:androidx.navigationevent.NavigationEvent) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/navigationevent#1.0.0)

*** ** * ** ***

Common/AllAndroid/JVMJavaScript
- Cmn

  ```
  class NavigationEvent
  ```

*** ** * ** ***

Represents a system navigation event, such as a predictive back gesture or a back button press.

This class standardizes various platform signals (e.g., touch gestures, key events) into a single, consistent format. This allows handlers like `https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEventDispatcher` to process navigation actions uniformly without needing to know the specific source of the event.

Note that not all parameters apply to every type of navigation event. For example, `https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEvent#touchX()` and `https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEvent#touchY()` are only relevant for gesture-based navigation.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEventHandler` |   |
| `https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEventDispatcher` |   |

## Summary

| ### Constants |
|---|---|---|
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEvent#EDGE_LEFT() = 0` Indicates the navigation gesture originates from the left edge of the screen. | Cmn |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEvent#EDGE_NONE() = 2` Indicates the navigation event was not caused by an edge swipe. | Cmn |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEvent#EDGE_RIGHT() = 1` Indicates the navigation gesture originates from the right edge of the screen. | Cmn |

| ### Public constructors |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEvent#NavigationEvent(kotlin.Int,kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Long)( swipeEdge: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, progress: @https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange(from = 0.0, to = 1.0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, touchX: @https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange(from = 0.0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, touchY: @https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange(from = 0.0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, frameTimeMillis: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html )` | Cmn |

| ### Public functions |
|---|---|---|
| `open operator https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEvent#equals(kotlin.Any)(other: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?)` | Cmn |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEvent#hashCode()()` | Cmn |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEvent#toString()()` | Cmn |

| ### Public properties |
|---|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | `https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEvent#frameTimeMillis()` The timestamp in milliseconds when this navigation event occurred. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEvent#progress()` A normalized value from `0.0F` to `1.0F` indicating how far the navigation action has progressed. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEvent#swipeEdge()` Indicates which screen edge a swipe-based navigation gesture originates from. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEvent#touchX()` The absolute X coordinate of the touch point for this event, in pixels, in the coordinate space of the screen. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEvent#touchY()` The absolute Y coordinate of the touch point for this event, in pixels, in the coordinate space of the screen. | Cmn |

| ### Extension functions |
|---|---|---|
| `https://developer.android.com/reference/android/window/BackEvent.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresApi(value = 34) https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEvent.https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEvent#(androidx.navigationevent.NavigationEvent).toBackEvent()()` | android |

## Constants

### EDGE_LEFT

Cmn

```
const val EDGE_LEFT = 0: Int
```

Indicates the navigation gesture originates from the left edge of the screen.

### EDGE_NONE

Cmn

```
const val EDGE_NONE = 2: Int
```

Indicates the navigation event was not caused by an edge swipe. This applies to actions like a 3-button navigation press or a hardware back button event.

### EDGE_RIGHT

Cmn

```
const val EDGE_RIGHT = 1: Int
```

Indicates the navigation gesture originates from the right edge of the screen.

## Public constructors

### NavigationEvent

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/navigationevent#1.0.0)

```
NavigationEvent(
    swipeEdge: Int = EDGE_NONE,
    progress: @FloatRange(from = 0.0, to = 1.0) Float = 0.0f,
    touchX: @FloatRange(from = 0.0) Float = 0.0f,
    touchY: @FloatRange(from = 0.0) Float = 0.0f,
    frameTimeMillis: Long = 0
)
```

## Public functions

### equals

Cmn

```
open operator fun equals(other: Any?): Boolean
```

### hashCode

Cmn

```
open fun hashCode(): Int
```

### toString

Cmn

```
open fun toString(): String
```

## Public properties

### frameTimeMillis

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/navigationevent#1.0.0)

```
val frameTimeMillis: Long
```

The timestamp in milliseconds when this navigation event occurred. This is useful for synchronizing animations or for debugging event sequences.

### progress

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/navigationevent#1.0.0)

```
val progress: Float
```

A normalized value from `0.0F` to `1.0F` indicating how far the navigation action has progressed.

For continuous gestures like a swipe, this value will update incrementally. For discrete actions like a button press, a single event with `progress` of `0.0F` may be sent when the action starts, followed by a completion signal.

### swipeEdge

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/navigationevent#1.0.0)

```
val swipeEdge: Int
```

Indicates which screen edge a swipe-based navigation gesture originates from. For non-swipe events, this will be `https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEvent#EDGE_NONE()`.

### touchX

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/navigationevent#1.0.0)

```
val touchX: Float
```

The absolute X coordinate of the touch point for this event, in pixels, in the coordinate space of the screen. For events not triggered by a touch gesture (e.g., a key press), this will be `0.0F`.

### touchY

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/navigationevent#1.0.0)

```
val touchY: Float
```

The absolute Y coordinate of the touch point for this event, in pixels, in the coordinate space of the screen. For events not triggered by a touch gesture (e.g., a key press), this will be `0.0F`.

## Extension functions

### NavigationEvent.toBackEvent

android Artifact: [androidx.navigationevent:navigationevent](https://developer.android.com/jetpack/androidx/releases/navigationevent) [View Source](https://cs.android.com/search?q=file:androidx/navigationevent/NavigationEvent.android.kt+function:toBackEvent)

```
@RequiresApi(value = 34)
fun NavigationEvent.toBackEvent(): BackEvent
```